BeautifySkinFrom2.cpp 72 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721
  1. // BeautifySkinFrom2.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "BeautifySkinFrom2.h"
  6. #include "MyMdi.H"
  7. #include "ModifyDinDan.h"
  8. #include "ImportPhoto.h"
  9. #include "ShowPic.h"
  10. #include "SelectPhotoDlg.h"
  11. #include "./helper/ffsco.h"
  12. #include "ShowCut.h"
  13. #include "CompressOption.h"
  14. #include "NetShareInfo.h"
  15. #include "DlgChuXiuInfo.h"
  16. #ifdef _DEBUG
  17. #define new DEBUG_NEW
  18. #undef THIS_FILE
  19. static char THIS_FILE[] = __FILE__;
  20. #endif
  21. IMPLEMENT_DYNCREATE(BeautifySkinFrom2, MyFormView)
  22. BeautifySkinFrom2::BeautifySkinFrom2(): MyFormView(BeautifySkinFrom2::IDD)
  23. {
  24. m_filter = _T("");
  25. m_nAdd = 0;
  26. if (g_bAllBranch)
  27. {
  28. m_nAdd = 1;
  29. }
  30. }
  31. BeautifySkinFrom2::~BeautifySkinFrom2()
  32. {
  33. }
  34. void BeautifySkinFrom2::DoDataExchange(CDataExchange* pDX)
  35. {
  36. MyFormView::DoDataExchange(pDX);
  37. DDX_Control(pDX, IDC_COMBO1, m_combo1);
  38. DDX_Control(pDX, IDC_LIST2, m_FurtherList);
  39. DDX_Control(pDX, IDC_STATIC1, m_static1);
  40. DDX_CBString(pDX, IDC_COMBO1, m_filter);
  41. }
  42. BEGIN_MESSAGE_MAP(BeautifySkinFrom2, MyFormView)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
  48. ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto)
  49. ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto)
  50. ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2)
  51. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  52. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
  53. ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
  54. ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
  55. ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
  56. END_MESSAGE_MAP()
  57. #ifdef _DEBUG
  58. void BeautifySkinFrom2::AssertValid() const
  59. {
  60. MyFormView::AssertValid();
  61. }
  62. void BeautifySkinFrom2::Dump(CDumpContext& dc) const
  63. {
  64. MyFormView::Dump(dc);
  65. }
  66. #endif
  67. void BeautifySkinFrom2::OnInitialUpdate()
  68. {
  69. MyFormView::OnInitialUpdate();
  70. CMyMdi Mdi;
  71. Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
  72. CRect rc2;
  73. GetWindowRect(rc2);
  74. ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE);
  75. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0);
  76. int idarray[] = { IDC_BUTprint3, IDC_BUTexportphoto, IDC_BUTimportphoto, IDC_BUTshowphoto, IDC_BUTexportphoto2, IDC_BUTclose };
  77. int idcount = 6;
  78. int btnwid;
  79. CRect prerc;
  80. for (int a = idcount - 2; a >= 0; a--)
  81. {
  82. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  83. ScreenToClient(prerc);
  84. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  85. ScreenToClient(rc2);
  86. btnwid = rc2.Width();
  87. rc2.right = prerc.left;
  88. rc2.left = rc2.right - btnwid;
  89. GetDlgItem(idarray[a])->MoveWindow(rc2);
  90. }
  91. m_static1.SetFont(&g_titlefont);
  92. if (g_bAllBranch == 0)
  93. {
  94. #ifdef CHILD_VERSION
  95. m_FurtherList.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
  96. #else
  97. m_FurtherList.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  98. #endif
  99. m_FurtherList.LoadColumnInfo(122);
  100. }
  101. else
  102. {
  103. #ifdef CHILD_VERSION
  104. m_FurtherList.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
  105. #else
  106. m_FurtherList.SetHeadings("店名,100;订单号,100;男宾姓名,100;女宾姓名,100;修片,100;选片,100;选片日期,100;精修,100;精修日期,100;设计,100;看设计日期,100;加急,100;取件日期,100;修片人,100;精修人,100;接单人,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
  107. #endif
  108. m_FurtherList.LoadColumnInfo(198);
  109. GetDlgItem(IDC_BUTprint3)->ShowWindow(1);
  110. }
  111. GetData();
  112. m_combo1.AddString(g_user.name);
  113. m_combo1.GetWindowRect(rc2);
  114. ScreenToClient(rc2);
  115. rc2.bottom += 200;
  116. m_combo1.MoveWindow(rc2);
  117. GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2);
  118. SetComboHei(&m_combo1, rc2.Height());
  119. GetDlgItem(IDC_BUTexportphoto)->EnableWindow(IsHasRights2new(10));
  120. GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(11));
  121. }
  122. void BeautifySkinFrom2::FillGrid(BOOL bStatus)
  123. {
  124. if (g_bSearchFilter)
  125. {
  126. m_FurtherList.DeleteAllItems2();
  127. int ii = 0;
  128. m_FurtherList.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  129. int count = 0;
  130. {
  131. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  132. {
  133. // 条件查询==精修日期
  134. if (g_filterdate1 != "")
  135. {
  136. if (m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(7 + m_nAdd) > g_filterdate2)
  137. continue;
  138. }
  139. if (g_waiter1 != "")
  140. {
  141. // 条件查询==精修人;
  142. if (m_List1array.ElementAt(ii).ElementAt(13 + m_nAdd) != g_waiter1)
  143. continue;
  144. }
  145. if (g_bAllBranch && g_filterbranch != "")
  146. {
  147. if (m_List1array.ElementAt(ii).ElementAt(0) != g_filterbranch)
  148. continue;
  149. }
  150. if (1)
  151. {
  152. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  153. }
  154. }
  155. }
  156. m_FurtherList.m_arLabels.SetSize(count, 1);
  157. ii = count;
  158. m_FurtherList.m_LabelCount = ii;
  159. m_FurtherList.SetItemCountEx(ii);
  160. CString str;
  161. str.Format("单数:%d", ii);
  162. SetDlgItemText(IDC_STATIC2, str);
  163. }
  164. else
  165. {
  166. m_FurtherList.DeleteAllItems2();
  167. int ii = 0;
  168. m_FurtherList.m_arLabels.SetSize(m_List1array.GetSize(), 1);
  169. int count = 0;
  170. if (m_filter.IsEmpty())
  171. {
  172. if (bStatus)
  173. {
  174. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  175. {
  176. // 条件查询==选片状态&&精修状态;
  177. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" && m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK")
  178. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  179. }
  180. }
  181. else
  182. {
  183. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  184. {
  185. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  186. }
  187. }
  188. }
  189. else
  190. {
  191. if (bStatus)
  192. {
  193. int type = GetType(m_filter);
  194. if (type == 1)//电话
  195. {
  196. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  197. {
  198. // 查询条件==选片状态&&精修状态&&(手机1||手机2)
  199. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
  200. m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
  201. (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).Find(m_filter) != -1))
  202. {
  203. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  204. }
  205. }
  206. }
  207. else if (type == 2)//拼音
  208. {
  209. m_filter.MakeUpper();
  210. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  211. {
  212. // 查询条件==选片状态&&精修状态&&(拼音1||拼音2)
  213. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
  214. m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
  215. (m_List1array.ElementAt(ii).ElementAt(19 + m_nAdd).Find(m_filter) != -1 ||m_List1array.ElementAt(ii).ElementAt(20 + m_nAdd).Find(m_filter) != -1))
  216. {
  217. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  218. }
  219. }
  220. }
  221. else
  222. {
  223. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  224. {
  225. // 查询条件==选片状态&&精修状态&&(……)
  226. if (m_List1array.ElementAt(ii).ElementAt(4 + m_nAdd) == "OK" &&
  227. m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) != "OK" &&
  228. (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  229. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  230. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  231. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  232. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || \
  233. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || \
  234. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  235. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
  236. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
  237. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
  238. m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1 || \
  239. m_List1array.ElementAt(ii).ElementAt(19).Find(m_filter) != -1))
  240. {
  241. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  242. }
  243. }
  244. }
  245. }
  246. else
  247. {
  248. int type = GetType(m_filter);
  249. if (type == 1)//电话
  250. {
  251. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  252. {
  253. // 查询条件==手机1||手机2
  254. if (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 ||
  255. m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).Find(m_filter) != -1)
  256. {
  257. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  258. }
  259. }
  260. }
  261. else if (type == 2)//拼音
  262. {
  263. m_filter.MakeUpper();
  264. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  265. {
  266. // 查询条件==拼音1||拼音2
  267. if (m_List1array.ElementAt(ii).ElementAt(19 + m_nAdd).Find(m_filter) != -1 ||
  268. m_List1array.ElementAt(ii).ElementAt(20 + m_nAdd).Find(m_filter) != -1)
  269. {
  270. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  271. }
  272. }
  273. }
  274. else
  275. {
  276. for (ii = 0; ii < m_FurtherList.m_arLabels.GetSize(); ii++)
  277. {
  278. if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || \
  279. m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || \
  280. m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || \
  281. m_List1array.ElementAt(ii).ElementAt(3).Find(m_filter) != -1 || \
  282. m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || \
  283. m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || \
  284. m_List1array.ElementAt(ii).ElementAt(14).Find(m_filter) != -1 || \
  285. m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || \
  286. m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1 || \
  287. m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
  288. m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1 || \
  289. m_List1array.ElementAt(ii).ElementAt(20).Find(m_filter) != -1)
  290. {
  291. m_FurtherList.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii));
  292. }
  293. }
  294. }
  295. }
  296. }
  297. m_FurtherList.m_arLabels.SetSize(count, 1);
  298. ii = count;
  299. m_FurtherList.m_LabelCount = ii;
  300. m_FurtherList.SetItemCountEx(ii);
  301. CString str;
  302. str.Format("单数:%d", ii);
  303. SetDlgItemText(IDC_STATIC2, str);
  304. }
  305. if (!g_id.IsEmpty())
  306. {
  307. for (int i = 0; i < m_FurtherList.GetItemCount(); i++)
  308. {
  309. if (g_id == m_FurtherList.GetItemText(i, 0 + m_nAdd))
  310. {
  311. m_FurtherList.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
  312. m_FurtherList.EnsureVisible(i, FALSE);
  313. break;
  314. }
  315. }
  316. }
  317. }
  318. void BeautifySkinFrom2::OnBUTclose()
  319. {
  320. GetParent()->SendMessage(WM_CLOSE);
  321. }
  322. void BeautifySkinFrom2::OnSelchangeCombo1()
  323. {
  324. SetTimer(1, 100, NULL);
  325. }
  326. void BeautifySkinFrom2::OnTimer(UINT nIDEvent)
  327. {
  328. KillTimer(nIDEvent);
  329. OnButton1();
  330. }
  331. BOOL BeautifySkinFrom2::PreTranslateMessage(MSG* pMsg)
  332. {
  333. try
  334. {
  335. if (pMsg->message == WM_KEYDOWN)
  336. {
  337. switch (pMsg->wParam)
  338. {
  339. case VK_RETURN:
  340. OnButton1();
  341. return 1;
  342. case 0x43: // copy
  343. if ((GetKeyState(VK_CONTROL) & 0x80))
  344. {
  345. GetFocus()->SendMessage(WM_COPY);
  346. return TRUE;
  347. }
  348. break;
  349. case 0x56: //Ctrl + V:
  350. if ((GetKeyState(VK_CONTROL) & 0x80))
  351. {
  352. GetFocus()->SendMessage(WM_PASTE);
  353. return TRUE;
  354. }
  355. break;
  356. case 0x58: // cut
  357. if ((GetKeyState(VK_CONTROL) & 0x80))
  358. {
  359. GetFocus()->SendMessage(WM_CUT);
  360. return TRUE;
  361. }
  362. break;
  363. case 0x5A: //undo
  364. case 0x59: //redo
  365. if ((GetKeyState(VK_CONTROL) & 0x80))
  366. {
  367. GetFocus()->SendMessage(WM_UNDO);
  368. return TRUE;
  369. }
  370. break;
  371. }
  372. }
  373. return MyFormView::PreTranslateMessage(pMsg);
  374. }
  375. catch (...)
  376. {
  377. }
  378. return true;
  379. }
  380. void BeautifySkinFrom2::OnBUTimportphoto() // 导入精修片 按钮;
  381. {
  382. #ifdef USE_KERNEL_DLL
  383. POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
  384. if ( pos == NULL )
  385. {
  386. AfxMessageBox(_T("请选中您要导入精修片的订单!"),MB_ICONINFORMATION);
  387. return;
  388. }
  389. INT nItemCount = m_FurtherList.GetItemCount();
  390. INT nSelectedItem = m_FurtherList.GetNextSelectedItem(pos);
  391. // 获取列表信息:域名、订单号、顾客信息、景点名(成长套系名)、精修人、精修状态、精修日期;
  392. CString strBranchName = _T("");
  393. CString strBranchId = _T("");
  394. CString strOrderNum = _T("");
  395. CString strScenery = _T("");
  396. CString strCustomerInfo = _T("");
  397. CString strJingxiuRen = _T("");
  398. CString strJingxiuState = _T("");
  399. CString strJingxiuDate = _T("");
  400. // 获取域名;
  401. if ( g_bAllBranch )
  402. {// 多店汇总时;
  403. strBranchName = m_FurtherList.GetItemText(nSelectedItem, 0);
  404. strBranchId = GetDomainFromBranch( strBranchName );
  405. }
  406. else
  407. {
  408. if ( g_branchname.IsEmpty() )
  409. {// 连接本店时;
  410. strBranchId = g_domain;
  411. }
  412. else
  413. {// 连接分店时;
  414. strBranchName = g_branchname;
  415. strBranchId = GetDomainFromBranch( g_branchname );
  416. }
  417. }
  418. // 获取订单号;
  419. strOrderNum = m_FurtherList.GetItemText(nSelectedItem, 0 + m_nAdd);
  420. // 获取精修师;
  421. strJingxiuRen = m_FurtherList.GetItemText(nSelectedItem, 13 + m_nAdd); // 11
  422. // 获取精修状态;
  423. strJingxiuState = m_FurtherList.GetItemText(nSelectedItem, 6 + m_nAdd);
  424. // 获取精修日期;
  425. strJingxiuDate = m_FurtherList.GetItemText(nSelectedItem, 7 + m_nAdd);
  426. // 获取顾客信息;
  427. strCustomerInfo = m_FurtherList.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_FurtherList.GetItemText(nSelectedItem, 2 + m_nAdd);
  428. CDlgChuXiuInfo xpdlg;
  429. xpdlg.m_strOrderNumber = strOrderNum;
  430. xpdlg.m_strXiupianRen = strJingxiuRen;
  431. if ( strJingxiuState == _T("OK") )
  432. xpdlg.m_nXiupianStatus = 0;
  433. else if ( strJingxiuState == _T("修片中"))
  434. xpdlg.m_nXiupianStatus = 1;
  435. else if ( strJingxiuState == _T("未修"))
  436. xpdlg.m_nXiupianStatus = 2;
  437. CString strSQL = _T("");
  438. if ( xpdlg.DoModal() == IDOK )
  439. {
  440. if ( xpdlg.m_bGrowthTx )
  441. strScenery = xpdlg.m_strScenery;
  442. if ( xpdlg.m_nXiupianStatus == 0 )
  443. strJingxiuState = _T("OK");
  444. else if ( xpdlg.m_nXiupianStatus == 1)
  445. strJingxiuState = _T("修片中");
  446. else if ( xpdlg.m_nXiupianStatus == 2 )
  447. strJingxiuState = _T("未修");
  448. strJingxiuRen = xpdlg.m_strXiupianRen;
  449. if (strJingxiuDate.IsEmpty())
  450. strSQL.Format(_T("update dindan set waiter7 = '%s', status6 = '%s', time9 = '%s' where id = '%s' "), strJingxiuRen, strJingxiuState, g_date, strOrderNum);
  451. else
  452. strSQL.Format(_T("update dindan set waiter7 = '%s', status6 = '%s' where id = '%s'"), strJingxiuRen, strJingxiuState, strOrderNum);
  453. // 构建更新包,发送到服务端更新数据;
  454. g_sendhead.bsql = TRUE;
  455. if ( g_bAllBranch )
  456. { // 多店汇总时;
  457. g_branchip = GetBranchIPbyId(strBranchId);
  458. g_pMainWnd->OnDisconnect();
  459. g_branchname = strBranchName;
  460. g_bBranchModify = TRUE;
  461. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  462. g_pMainWnd->OnDisconnect();
  463. g_bBranchModify = FALSE;
  464. g_branchip = g_branchname = "";
  465. }
  466. else
  467. {// 连接本店或分店时;
  468. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  469. }
  470. /////////////////////////////////////////////////////////////////////////////////////////////////
  471. // 接收服务器返回的数据,并刷新界面;
  472. if (g_bSendOK == 0)
  473. {
  474. OutputDebugString(_T("接收服务信息失败\n"));
  475. return;
  476. }
  477. if ( g_bAllBranch == 0)
  478. {// 连接本店或分店时;
  479. GetData();
  480. }
  481. else
  482. {// 多店汇总时;
  483. for (int i = 0; i < m_List1array.GetSize(); i++)
  484. {
  485. if ( strOrderNum == m_List1array.ElementAt(i).ElementAt(1) && strBranchName == m_List1array.ElementAt(i).ElementAt(0))
  486. {
  487. m_List1array.ElementAt(i).SetAt(6 + m_nAdd, strJingxiuState);
  488. if ( strJingxiuDate.IsEmpty() )
  489. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
  490. m_List1array.ElementAt(i).SetAt(13 + m_nAdd, strJingxiuRen);
  491. FillGrid();
  492. break;
  493. }
  494. }
  495. }
  496. }
  497. else
  498. {
  499. // 开始导入初修片;
  500. if ( MessageBox(_T("是否现在开始导入精修片!"), _T("导片提示:导入精修片"), MB_TOPMOST|MB_YESNO|MB_ICONWARNING ) != IDYES )
  501. {// 是否马上导入相片;
  502. return;
  503. }
  504. if ( xpdlg.m_bGrowthTx )
  505. strScenery = xpdlg.m_strScenery;
  506. if ( xpdlg.m_bGrowthTx && strScenery.IsEmpty() )
  507. {
  508. AfxMessageBox(_T("儿童成长套系导片必须选择套系名!"));
  509. return;
  510. }
  511. }
  512. /////////////////////////////////////////////////////////////////////////////////////////////////
  513. if ( g_pIMGProcess == NULL )
  514. {
  515. return;
  516. }
  517. ImgImportInterface *pImport = NULL;
  518. g_pIMGProcess->QueryInterface(IID_ImgImportInterface, (void**)&pImport);
  519. if ( pImport )
  520. {
  521. pImport->ImportFurtherImg(
  522. FALSE, // 文件夹形式打开源或多选文件形式;
  523. strBranchId, // 分店域名;
  524. strOrderNum, // 订单号;
  525. strCustomerInfo, // 顾客信息,可任意组合;
  526. !strScenery.IsEmpty(), // 导入时,是否生成景点名文件夹;
  527. strScenery, // 导入时,景点名;
  528. _T("*.jpg|*.jpeg"), // 导入时,主扩展名相片;
  529. INVALID_COPY_PIX, // 导入时,主扩展名相片的压缩像素;
  530. _T("*.nef|*.cr2"), // 导入时,附加的扩展名相片;
  531. TRUE, // 导入时,是否生成缩略图;
  532. SET_PIX(100,100), // 导入时,生成的缩略图像素大小;
  533. FALSE // 导入时,文件存在时是否覆盖;
  534. );
  535. g_pIMGProcess->Release();
  536. WriteOptLog(_T("导入精修,订单号:%s"),strOrderNum);
  537. }
  538. // 结束;
  539. #else
  540. POSITION pos;
  541. pos = m_FurtherList.GetFirstSelectedItemPosition();
  542. if (pos == NULL)
  543. {
  544. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  545. return;
  546. }
  547. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  548. CString branch;
  549. CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  550. if (g_bAllBranch)
  551. branch = m_FurtherList.GetItemText(iItem, 0);
  552. CString oldstatus = m_FurtherList.GetItemText(iItem, 6 + m_nAdd);
  553. CString time9 = m_FurtherList.GetItemText(iItem, 7 + m_nAdd);
  554. CString name = m_FurtherList.GetItemText(iItem, 1 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  555. name.TrimLeft(",");
  556. name.TrimRight(",");
  557. name = "客人:" + name;
  558. CString phone = m_FurtherList.GetItemText(iItem, 15 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 16 + m_nAdd);
  559. phone.TrimLeft(",");
  560. phone.TrimRight(",");
  561. phone = "电话:" + phone;
  562. CString strDomain = _T("");
  563. CString savepath = _T("");
  564. if (g_bAllBranch)
  565. strDomain = GetDomainFromBranch(branch);
  566. else
  567. {
  568. if(g_branchname != _T(""))
  569. strDomain = GetDomainFromBranch(g_branchname);
  570. }
  571. //////////////////////////////////////////////////////////////////////////
  572. // 获取可用的共享目录;
  573. #if USE_SHARE_FLORD // 2015.04.13
  574. TCHAR szSharePath[MAX_PATH];
  575. //if( GetEnableShareDirectory(3,id,branch,szSharePath) )
  576. if (CNetShareInfo::GetInstance()->GetEnableShareDirectory(3, id, strDomain, szSharePath))
  577. {
  578. savepath.Format("%s\\",szSharePath);
  579. }
  580. else
  581. {
  582. AfxMessageBox(_T("没有可用的共享目录!"));
  583. return;
  584. }
  585. #else
  586. savepath += id + "\\";
  587. #endif
  588. //////////////////////////////////////////////////////////////////////////
  589. if (::CheckFolderFileExist(savepath) == 0)
  590. {
  591. if ( !CreateDirectory(savepath, NULL) )
  592. {
  593. DWORD dwError = GetLastError();
  594. AfxMessageBox(_T("创建精修订单目录失败"));
  595. return;
  596. }
  597. }
  598. CString srcdir; CString str;
  599. GetSavePath(srcdir);
  600. if (srcdir.IsEmpty())
  601. {
  602. CString status6;
  603. if (AfxMessageBox("客照是否全部精修完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  604. status6 = "OK";
  605. else
  606. status6 = "修片中";
  607. CString sql;
  608. if (time9.IsEmpty())
  609. sql = "update dindan set status6='" + status6 + "',time9='" + g_date + "' where id='" + id + "'";
  610. else
  611. sql = "update dindan set status6='" + status6 + "' where id='" + id + "'";
  612. g_sendhead.bsql = 1;
  613. if (g_bAllBranch)
  614. {
  615. g_branchip = GetIP(branch);
  616. g_pMainWnd->OnDisconnect();
  617. g_branchname = branch;
  618. g_bBranchModify = 1;
  619. g_pMainWnd->ProcessChatMessageRequest2(sql);
  620. g_pMainWnd->OnDisconnect();
  621. g_bBranchModify = 0;
  622. g_branchip = g_branchname = "";
  623. }
  624. else
  625. g_pMainWnd->ProcessChatMessageRequest2(sql);
  626. if (g_bSendOK == 0)return;
  627. if (g_bAllBranch == 0)
  628. {
  629. GetData();
  630. }
  631. else
  632. {
  633. for (int i = 0; i < m_List1array.GetSize(); i++)
  634. {
  635. if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
  636. {
  637. m_List1array.ElementAt(i).SetAt(6 + m_nAdd, status6);
  638. if (time9.IsEmpty())
  639. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
  640. FillGrid();
  641. break;
  642. }
  643. }
  644. }
  645. return;
  646. }
  647. if (srcdir.GetLength() < 4)
  648. {
  649. AfxMessageBox("请选择正确的您文件所在的目录!", MB_ICONSTOP);
  650. return;
  651. }
  652. if (oldstatus != "未修")
  653. {
  654. str.Format("%s\r\n%s\r\n此单已导入过修片,确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone);
  655. if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)
  656. return;
  657. }
  658. else
  659. {
  660. str.Format("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone);
  661. if (AfxMessageBox(str, MB_YESNO | MB_ICONINFORMATION) != IDYES)
  662. return;
  663. }
  664. CStringArray array;
  665. CStringArray desarray;
  666. CStringArray dirarray;
  667. if (1)
  668. {
  669. // 1.获取源目录下的所有文件,包含子目录;
  670. using namespace helper_coffs;
  671. ffsco o;
  672. o.dirs(1);
  673. o.find(LPCSTR(srcdir), LPCSTR("*.*"));
  674. ffsco::typeT coo;
  675. ffsco::typeT::iterator it;
  676. coo = o.co_dir();
  677. for (it = coo.begin(); coo.end() != it; it++)
  678. {
  679. str = (*it).c_str();
  680. if (FindArray(&dirarray, str) == -1)
  681. {
  682. dirarray.Add(str);
  683. if (str != dirarray.ElementAt(0))
  684. {
  685. str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
  686. if (::CheckFolderFileExist(str) == 0)
  687. ::CreateDirectory(str, NULL);
  688. }
  689. }
  690. }
  691. }
  692. if (1)
  693. {
  694. // 2.从每个子目录下查找所有的相片;
  695. for (int i = 0; i < dirarray.GetSize(); i++)
  696. {
  697. using namespace helper_coffs;
  698. ffsco o;
  699. o.dirs(0);
  700. o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
  701. ffsco::typeT coo;
  702. ffsco::typeT::iterator it;
  703. coo = o.co_file();
  704. for (it = coo.begin();coo.end() != it;it++)
  705. {
  706. str = (*it).c_str();
  707. array.Add(str);
  708. desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
  709. }
  710. }
  711. }
  712. if (array.GetSize() == 0)return;
  713. ImportPhoto dlg;
  714. #if USE_SHARE_FLORD
  715. dlg.m_id = id; // add by 2015-07-06 Jeff;
  716. #endif
  717. dlg.m_branch = branch;
  718. dlg.m_nphototype = 2;
  719. dlg.m_bOverWrite = 1;
  720. dlg.m_pArray = &array;
  721. dlg.m_pDesArray = &desarray;
  722. dlg.m_savepath = savepath;
  723. #ifdef ENTERPRISE_VERSION
  724. // if(!g_branchname.IsEmpty ())
  725. {
  726. dlg.m_bSaveUploadTask = g_bSaveUploadTask3;
  727. dlg.m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(80);
  728. dlg.m_uploadtaskarray.Add(id + ";" + name);
  729. dlg.m_uploadtaskarray.Add("");
  730. dlg.m_uploadtaskarray.Add("");
  731. dlg.m_uploadtaskarray.Add("");
  732. dlg.m_uploadtaskarray.Add("");
  733. dlg.m_uploadtaskarray.Add("");
  734. dlg.m_uploadtaskarray.Add("");
  735. dlg.m_uploadtaskarray.Add("");
  736. dlg.m_uploadtaskarray.Add("");
  737. dlg.m_uploadtaskarray.Add("");
  738. }
  739. #endif
  740. dlg.DoModal();
  741. CString status6;
  742. if (AfxMessageBox("客照是否全部精修完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
  743. status6 = "OK";
  744. else
  745. status6 = "修片中";
  746. CString sql;
  747. if (time9.IsEmpty())
  748. sql = "update dindan set status6='" + status6 + "',waiter7='" + g_user.name + "',time9='" + g_date + "' where id='" + id + "'";
  749. else
  750. sql = "update dindan set status6='" + status6 + "',waiter7='" + g_user.name + "' where id='" + id + "'";
  751. g_sendhead.bsql = 1;
  752. if (g_bAllBranch)
  753. {
  754. g_branchip = GetIP(branch);
  755. g_pMainWnd->OnDisconnect();
  756. g_branchname = branch;
  757. g_bBranchModify = 1;
  758. g_pMainWnd->ProcessChatMessageRequest2(sql);
  759. g_pMainWnd->OnDisconnect();
  760. g_bBranchModify = 0;
  761. g_branchip = g_branchname = "";
  762. }
  763. else
  764. g_pMainWnd->ProcessChatMessageRequest2(sql);
  765. if (g_bSendOK == 0)return;
  766. savepath += "ok";
  767. ::DeleteFile(savepath); // 删除ok文件;
  768. AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
  769. if (g_bAllBranch == 0)
  770. {
  771. GetData();
  772. }
  773. else
  774. {
  775. for (int i = 0; i < m_List1array.GetSize(); i++)
  776. {
  777. if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
  778. {
  779. m_List1array.ElementAt(i).SetAt(6 + m_nAdd, status6);
  780. if (time9.IsEmpty())
  781. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, g_date);
  782. m_List1array.ElementAt(i).SetAt(11 + m_nAdd, g_user.name);
  783. FillGrid();
  784. break;
  785. }
  786. }
  787. }
  788. #endif
  789. }
  790. void BeautifySkinFrom2::OnBUTshowphoto() // 查看精修片;
  791. {
  792. POSITION pos;
  793. pos = m_FurtherList.GetFirstSelectedItemPosition();
  794. if (pos == NULL)
  795. {
  796. AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
  797. return;
  798. }
  799. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  800. CString branch;
  801. CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  802. if (g_bAllBranch)
  803. branch = m_FurtherList.GetItemText(iItem, 0);
  804. CString name = m_FurtherList.GetItemText(iItem, 1 + m_nAdd) + "," + m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  805. name.TrimLeft(",");
  806. name.TrimRight(",");
  807. name = "客人:" + name;
  808. ShowPic dlg;
  809. dlg.m_id = id;
  810. dlg.m_name = name;
  811. dlg.m_mode = 3;
  812. if(g_branchname == _T(""))
  813. dlg.m_path = g_path1 + "\\";
  814. else
  815. {
  816. dlg.m_branch = GetDomainFromBranch(g_branchname);
  817. CString branchpath = GetBranchPhotoPath(g_branchname);
  818. dlg.m_path = g_path1 + branchpath + "\\";
  819. }
  820. #ifndef USE_KERNEL_DLL
  821. #if USE_SHARE_FLORD
  822. // 根据域名,相片类型,订单号查找相片;
  823. dlg.m_aryOfShareDirectory.RemoveAll();
  824. CNetShareInfo::GetInstance()->LoadOrderImages(dlg.m_mode, dlg.m_id, g_domain, dlg.m_patharray1, &dlg.m_aryOfShareDirectory);
  825. #endif
  826. #endif
  827. dlg.m_path += id;
  828. dlg.m_path += "\\";
  829. dlg.DoModal();
  830. }
  831. //-----------------------------------------------------------------
  832. // remark by Jeff 2014-12-12
  833. // 函数:GetNo
  834. // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
  835. // 参数:
  836. // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
  837. // array:空的数组,用来存放解析后的相片名;
  838. // 返回:
  839. // 注意:更换分隔符造成的问题,在该函数已解决;
  840. //-----------------------------------------------------------------
  841. void BeautifySkinFrom2::GetNo(CString str, CStringArray &array)
  842. {
  843. if (!str.IsEmpty())
  844. {
  845. #ifdef USE_SEP_VEB
  846. int pos = str.Find(SEPS_VEB);
  847. #else
  848. int pos = str.Find(",");
  849. #endif
  850. while (pos != -1)
  851. {
  852. if (FindArray(&array, str.Left(pos)) == -1)
  853. array.Add(str.Left(pos));
  854. str = str.Right(str.GetLength() - pos - 1);
  855. #ifdef USE_SEP_VEB
  856. pos = str.Find(SEPS_VEB);
  857. #else
  858. pos = str.Find(",");
  859. #endif
  860. }
  861. if (FindArray(&array, str) == -1)
  862. array.Add(str);
  863. }
  864. }
  865. //-----------------------------------------------------------------
  866. // remark by Jeff 2014-12-12
  867. // 函数:GetSelName
  868. // 描述:
  869. // 参数:
  870. // name:由GetNo解析出来后的单个相片名,如:"001"
  871. // spnamearray:订单下的商品数组,case 50所得;
  872. // 返回:
  873. // 注意:更换分隔符造成的问题,在该函数已解决;
  874. //-----------------------------------------------------------------
  875. CString BeautifySkinFrom2::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
  876. {
  877. CString ret;
  878. #ifdef USE_SEP_VEB
  879. name = SEPS_VEB + name + SEPS_VEB;
  880. #else
  881. name = "," + name + ",";
  882. #endif
  883. CString str;
  884. for (int i = 0; i < spnamearray.GetSize(); i++)
  885. {
  886. #ifdef USE_SEP_VEB
  887. str = SEPS_VEB + spnamearray.ElementAt(i).ElementAt(6) + SEPS_VEB;
  888. #else
  889. str = "," + spnamearray.ElementAt(i).ElementAt(6) + ",";
  890. #endif
  891. if (str.Find(name) != -1)
  892. {
  893. ret += spnamearray.ElementAt(i).ElementAt(5);
  894. ret += ";";
  895. }
  896. }
  897. ret.TrimRight(";");
  898. ret.Replace("*", "x");
  899. return ret;
  900. }
  901. CString GetPathFromNo2(CString dir, CString no)
  902. {
  903. CString sRet;
  904. dir.TrimRight('\\');
  905. dir += "\\";
  906. CStringArray dirarray;
  907. CString temp;
  908. using namespace helper_coffs;
  909. ffsco o;
  910. o.dirs(1);
  911. o.find(LPCSTR(dir), LPCSTR("*.*"));
  912. ffsco::typeT coo;
  913. ffsco::typeT::iterator it;
  914. coo = o.co_dir();
  915. for (it = coo.begin();coo.end() != it;it++)
  916. {
  917. temp = (*it).c_str();
  918. if (::FindArray(&dirarray, temp) == -1 && temp != dir)
  919. {
  920. dirarray.Add(temp);
  921. }
  922. }
  923. for (int i = 0; i < dirarray.GetSize(); i++)
  924. {
  925. temp = dirarray.ElementAt(i);
  926. sRet.Format("%s%s.jpg", temp, no);
  927. if (::PathFileExists(sRet))return sRet;
  928. sRet.Replace(".jpg", ".raw");
  929. if (::PathFileExists(sRet))return sRet;
  930. sRet.Replace(".raw", ".nef");
  931. if (::PathFileExists(sRet))return sRet;
  932. sRet.Replace(".nef", ".cr2");
  933. if (::PathFileExists(sRet))return sRet;
  934. sRet.Replace(".cr2", ".jpg");
  935. if (::PathFileExists(sRet))return sRet;
  936. }
  937. return dir + no + ".jpg";
  938. }
  939. CString GetPathFromNo3(CString dir, CString no)
  940. {
  941. CString sRet;
  942. dir.TrimRight('\\');
  943. dir += "\\";
  944. CStringArray dirarray;
  945. CString temp;
  946. using namespace helper_coffs;
  947. ffsco o;
  948. o.dirs(1);
  949. o.find(LPCSTR(dir), LPCSTR("*.*"));
  950. ffsco::typeT coo;
  951. ffsco::typeT::iterator it;
  952. coo = o.co_dir();
  953. for (it = coo.begin();coo.end() != it;it++)
  954. {
  955. temp = (*it).c_str();
  956. if (::FindArray(&dirarray, temp) == -1 && temp != dir)
  957. {
  958. dirarray.Add(temp);
  959. }
  960. }
  961. for (int i = 0; i < dirarray.GetSize(); i++)
  962. {
  963. temp = dirarray.ElementAt(i);
  964. sRet.Format("%s%s.jpg", temp, no);
  965. if (::PathFileExists(sRet))return sRet;
  966. }
  967. return dir + no + ".jpg";
  968. }
  969. // 导出裁剪后的效果图;
  970. void BeautifySkinFrom2::OnBUTexportphoto() // 导出选好的片 按钮;
  971. {
  972. #ifdef USE_KERNEL_DLL
  973. // 判断用户是否有权限导出选好的片;
  974. if ( !IsHasRights2new(10) )
  975. {
  976. AfxMessageBox(_T("您没有权限导出选好的片!"));
  977. return;
  978. }
  979. // 获取列表信息;
  980. POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
  981. if ( pos == NULL )
  982. {
  983. AfxMessageBox(__T("请选中您要导片的订单!"));
  984. return;
  985. }
  986. INT nItemCount = m_FurtherList.GetItemCount();
  987. INT nSelectedItem = m_FurtherList.GetNextSelectedItem(pos);
  988. // 获取域名、订单号、景点名、顾客信息、选片人、选片状态、选片日期;
  989. CString strBranchName = _T("");
  990. CString strBranchId = _T("");
  991. CString strOrderNum = _T("");
  992. CString strScenery = _T("");
  993. CString strCustomerInfo = _T("");
  994. CString strXuanpianRen = _T("");
  995. CString strXuanpianState = _T("");
  996. CString strXuanpianDate = _T("");
  997. // 获取订单号;
  998. strOrderNum = m_FurtherList.GetItemText(nSelectedItem, 0 + m_nAdd);
  999. // 获取顾客信息;
  1000. strCustomerInfo = m_FurtherList.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_FurtherList.GetItemText(nSelectedItem, 2 + m_nAdd);
  1001. // 获取选片状态;
  1002. strXuanpianState = m_FurtherList.GetItemText(nSelectedItem, 4 + m_nAdd);
  1003. // 获取选片日期;
  1004. strXuanpianRen = m_FurtherList.GetItemText(nSelectedItem, 5 + m_nAdd);
  1005. if ( strXuanpianState == _T("未选") )
  1006. {
  1007. MessageBox(_T("此单未选片!"), _T("影楼管理"), MB_OK | MB_TOPMOST | MB_ICONINFORMATION );
  1008. return;
  1009. }
  1010. // 获取域名;
  1011. if ( g_bAllBranch )
  1012. {// 多店汇总;
  1013. strBranchName = m_FurtherList.GetItemText(nSelectedItem, 0);
  1014. strBranchId = GetDomainFromBranch(strBranchName);
  1015. }
  1016. else
  1017. {
  1018. if ( g_branchname.IsEmpty() )
  1019. {// 连接本店时;
  1020. strBranchId = g_domain;
  1021. }
  1022. else
  1023. {//连接分店时;
  1024. strBranchName = g_branchname;
  1025. strBranchId = GetDomainFromBranch( g_branchname );
  1026. }
  1027. }
  1028. // 获取景点名,需要读取dindanjd表获取,目前只支持儿童成长套系订单;
  1029. IsGrowthTx IsGrowthtxdlg;
  1030. IsGrowthtxdlg.m_mode = 1;
  1031. IsGrowthtxdlg.m_strOrderNumber = strOrderNum;
  1032. IsGrowthtxdlg.DoModal();
  1033. if( IsGrowthtxdlg.m_bReturnOK == 0 || (IsGrowthtxdlg.m_bGrowthTx && IsGrowthtxdlg.m_seltxname.IsEmpty()) )
  1034. {
  1035. return;
  1036. }
  1037. if ( IsGrowthtxdlg.m_bGrowthTx )
  1038. {
  1039. // 读取dindanjd表里的成长套系名,并返回选中的成长套系名;
  1040. strScenery = IsGrowthtxdlg.m_seltxname;
  1041. if ( strScenery == _T("全部") )
  1042. {
  1043. strScenery.Empty();
  1044. }
  1045. }
  1046. /////////////////////////////////////////////////////////////////////////////////////////////////
  1047. // 与服务器通信获取指定条件的订单商品信息;
  1048. CString strSQL = _T("");
  1049. #ifdef CHILD_VERSION
  1050. if ( IsGrowthtxdlg.m_bGrowthTx && !strScenery.IsEmpty() )
  1051. strSQL.Format(_T("id='%s' and growthtxname = '%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strScenery, strOrderNum, strOrderNum);
  1052. else
  1053. strSQL.Format(_T("id='%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
  1054. #else
  1055. strSQL.Format(_T("id='%s'; id='%s'; id='%s' and kind <> '2' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
  1056. #endif//CHILD_VERSION
  1057. g_sendhead.bsql = FALSE;
  1058. g_sendhead.code[0] = 50; // dindansp;
  1059. g_sendhead.code[1] = 11; // dindan;
  1060. g_sendhead.code[2] = 56; // dindansp;
  1061. g_sendhead.tabcount = 3;
  1062. if( g_bAllBranch )
  1063. {//多店汇总时;
  1064. g_branchip = GetBranchIPbyId(strBranchId);
  1065. g_pMainWnd->OnDisconnect();
  1066. g_branchname = strBranchName;
  1067. g_bBranchModify = TRUE;
  1068. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  1069. g_pMainWnd->OnDisconnect();
  1070. g_bBranchModify = FALSE;
  1071. g_branchip = g_branchname = _T("");
  1072. }
  1073. else
  1074. {// 连接本店或分店时;
  1075. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  1076. }
  1077. if( !g_bSendOK )
  1078. return ;
  1079. CArray<CStringArray, CStringArray> Arydindan;
  1080. CArray<CStringArray, CStringArray> Arydindansp;
  1081. CArray<CStringArray, CStringArray> Arydindansp2;
  1082. DataToArray( &Arydindansp, &Arydindan, &Arydindansp2 );
  1083. CString strTemp = _T("");
  1084. CStringArray AryImgNums;
  1085. CStringArray AryPerImgGoods;
  1086. // 获取所有dindansp记录no字段中的相片编号;
  1087. int i = 0;
  1088. int nSize = Arydindansp.GetSize();
  1089. for ( i = 0; i < nSize; i++)
  1090. {
  1091. strTemp = Arydindansp.ElementAt(i).ElementAt(6); // dindansp表中的no字段;
  1092. GetNo(strTemp, AryImgNums);
  1093. }
  1094. // 获取每张相片编号对应的商品,每个商品间用分号隔开;
  1095. nSize = AryImgNums.GetSize();
  1096. AryPerImgGoods.SetSize(nSize);
  1097. for ( i = 0; i < nSize; i++ )
  1098. {
  1099. strTemp = AryImgNums.ElementAt(i);
  1100. AryPerImgGoods.SetAt(i, GetSelName(strTemp, Arydindansp));
  1101. }
  1102. // 由于VC6.0传CStringArray给VC9.0DLL 时,会产生无法避免的兼容性问题,故使用CString传;
  1103. CString strImgNums = _T("");
  1104. for ( i = 0; i < AryImgNums.GetSize(); i++ )
  1105. {
  1106. strImgNums += AryImgNums.ElementAt(i);
  1107. strImgNums += _T("?|?");
  1108. }
  1109. CString strPerImgGoods = _T("");
  1110. for ( i = 0; i < AryPerImgGoods.GetSize(); i++ )
  1111. {// 商品名称,应该禁止包含非法字符;
  1112. strPerImgGoods += AryPerImgGoods.ElementAt(i);
  1113. strPerImgGoods += _T("?|?");
  1114. }
  1115. // 再选择导出的是初修片、原片、初修+原片,并且是否按产品生成文件夹分类相片或者相片名后带产品名;
  1116. SelectPhotoDlg selectdlg;
  1117. selectdlg.DoModal();
  1118. BOOL bExportWithName = selectdlg.m_check1;
  1119. INT bExportMode = selectdlg.m_mode; // 0 原片+初修, 1 原片, 2 初修;
  1120. // 保存导出相片的路径;
  1121. CString strSaveDirectory = _T("");
  1122. if ( g_pIMGProcess == NULL )
  1123. {
  1124. return ;
  1125. }
  1126. ImgExportInterface *pExport = NULL;
  1127. g_pIMGProcess->QueryInterface(IID_ImgExportInterface, (void**)&pExport);
  1128. if ( pExport )
  1129. {// 导出选好的片;
  1130. HGLOBAL hMemery = pExport->ExportSelectedBeautifyImg(
  1131. strBranchId,
  1132. strOrderNum,
  1133. strCustomerInfo,
  1134. !strScenery.IsEmpty(),
  1135. strScenery,
  1136. _T("*.jpg|*.jpeg"),
  1137. INVALID_COPY_PIX,
  1138. _T("*.nef|*.cr2|*.raw|"),
  1139. FALSE,
  1140. bExportWithName,
  1141. IsGrowthtxdlg.m_bGrowthTx,
  1142. bExportMode,
  1143. strImgNums,
  1144. strPerImgGoods,
  1145. Arydindan.ElementAt(0).ElementAt(60)
  1146. );
  1147. WriteOptLog(_T("导出选好的片,订单号:%s"),strOrderNum);
  1148. if ( hMemery )
  1149. {
  1150. CString strDir = _T("");
  1151. TCHAR* pszSaveDirectory = (TCHAR*)GlobalLock(hMemery);
  1152. GlobalUnlock(hMemery);
  1153. // 输出输出要求内容;
  1154. strDir.Format(_T("%s\\客户要求.txt"), pszSaveDirectory);
  1155. if ( Arydindan.GetSize() )
  1156. {
  1157. CStdioFile fp;
  1158. fp.Open(strDir, CFile::modeCreate | CFile::modeWrite);
  1159. fp.WriteString(_T("选片要求:\n"));
  1160. fp.WriteString(Arydindan.ElementAt(0).ElementAt(39) + _T(" ") + Arydindan.ElementAt(0).ElementAt(75));
  1161. fp.WriteString(_T("\n"));
  1162. fp.WriteString(_T("\n"));
  1163. fp.WriteString(_T("订单要求:\n"));
  1164. fp.WriteString(Arydindan.ElementAt(0).ElementAt(38));
  1165. fp.WriteString(_T("\n"));
  1166. fp.WriteString(_T("\n"));
  1167. fp.WriteString(_T("客人产品:\n"));
  1168. CString str;
  1169. str = _T("产品名称");
  1170. FillLength(str, 30);
  1171. str += _T("数量");
  1172. FillLength(str, 40);
  1173. #ifdef LKAY_VERSION
  1174. str += _T("P数");
  1175. FillLength(str, 50);
  1176. str += _T("加急");
  1177. FillLength(str, 60);
  1178. str += _T("取件日期");
  1179. FillLength(str, 70);
  1180. #else
  1181. str += _T("加急");
  1182. FillLength(str, 50);
  1183. str += _T("取件日期");
  1184. FillLength(str, 60);
  1185. #endif
  1186. fp.WriteString(str);
  1187. fp.WriteString(_T("\n"));
  1188. for (int i = 0; i < Arydindansp2.GetSize(); i++)
  1189. {
  1190. str.Empty();
  1191. str = Arydindansp2.ElementAt(i).ElementAt(0);
  1192. FillLength(str, 30);
  1193. str += Arydindansp2.ElementAt(i).ElementAt(1);
  1194. FillLength(str, 40);
  1195. #ifdef LKAY_VERSION
  1196. str += Arydindansp2.ElementAt(i).ElementAt(29); //p数
  1197. FillLength(str, 50);
  1198. str += Arydindansp2.ElementAt(i).ElementAt(18);
  1199. FillLength(str, 60);
  1200. str += Arydindansp2.ElementAt(i).ElementAt(19);
  1201. FillLength(str, 70);
  1202. #else
  1203. str += Arydindansp2.ElementAt(i).ElementAt(18);
  1204. FillLength(str, 50);
  1205. str += Arydindansp2.ElementAt(i).ElementAt(19);
  1206. FillLength(str, 60);
  1207. #endif
  1208. fp.WriteString(str);
  1209. fp.WriteString(_T("\n"));
  1210. }
  1211. fp.Close();
  1212. }
  1213. // 导出条形码位图;
  1214. if ( g_bExportBarCode )
  1215. {
  1216. for ( int j = Arydindansp.GetSize() - 1; j >= 0; j-- )
  1217. {
  1218. if ( Arydindansp.ElementAt(j).ElementAt(6).IsEmpty() )
  1219. Arydindansp.RemoveAt(j);
  1220. }
  1221. if ( !bExportWithName )
  1222. {
  1223. for ( int i = 0; i < Arydindansp.GetSize(); i++ )
  1224. {
  1225. strDir.Format(_T("%s\\%s"), pszSaveDirectory, Arydindansp.ElementAt(i).ElementAt(5));
  1226. if ( PathFileExists(strDir) )
  1227. {
  1228. // 商品目录存在才导出;
  1229. 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);
  1230. }
  1231. }
  1232. }
  1233. pExport->ExportOrderBarCodeImg(0, g_screenwid, g_screenhei*3, 1, 40, Arydindansp, pszSaveDirectory);
  1234. }
  1235. }
  1236. OutputDebugString(_T("导出选好的片!\n"));
  1237. }
  1238. pExport->Release();
  1239. // 结束;
  1240. #else
  1241. // 1.判断权限;
  1242. if (IsHasRights2new(10) == 0)return;
  1243. #if USE_SHARE_FLORD
  1244. BOOL bOfmat = FALSE;
  1245. BOOL bGrowth = FALSE;
  1246. BOOL bExportWithName = FALSE;
  1247. CString name1,name2,branch,strdomain,strOrderNumber,strGrowhTx = _T("");
  1248. CStringArray array,spnamearray2;
  1249. OUT CArray<CStringArray, CStringArray> sparray2;
  1250. GetCurSelRecord(name1,name2,strOrderNumber,branch,strdomain);
  1251. int nResult = GetImageWithGoods(branch,strdomain,strOrderNumber,bGrowth,strGrowhTx,bExportWithName,array,spnamearray2,sparray2);
  1252. if ( nResult == -1 )
  1253. {
  1254. // 没有任务相片存在于共享目录中;
  1255. return;
  1256. }
  1257. CString strSaveDiretory;
  1258. GetSavePath(strSaveDiretory);
  1259. if(strSaveDiretory.IsEmpty())return;
  1260. strSaveDiretory.TrimRight ('\\');
  1261. strSaveDiretory+="\\";
  1262. strSaveDiretory+=strOrderNumber;
  1263. strSaveDiretory+=g_branchname;
  1264. if(g_bAllBranch)
  1265. {
  1266. if(GetBranchPhotoPath(branch)!="")
  1267. strSaveDiretory+=branch;
  1268. }
  1269. strSaveDiretory+=name1;
  1270. strSaveDiretory+=name2;
  1271. strSaveDiretory+="选片";
  1272. strSaveDiretory+="\\";
  1273. if ( nResult == 3 )
  1274. {
  1275. // 选择导出的是初修,但初修无片,导出原片;
  1276. strSaveDiretory.Delete(strSaveDiretory.GetLength()-1, 1);
  1277. strSaveDiretory += _T("(未修)\\");
  1278. bOfmat = TRUE;
  1279. }
  1280. ::CreateDirectory (strSaveDiretory, NULL);
  1281. #else
  1282. // 2.获取选中列的信息,如订单号;
  1283. UpdateData();
  1284. POSITION pos;
  1285. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1286. if (pos == NULL)
  1287. {
  1288. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  1289. return;
  1290. }
  1291. // 2.1.获取订单的选片状态;
  1292. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1293. CString status2 = m_FurtherList.GetItemText(iItem, 4 + m_nAdd);
  1294. if (status2 != "OK")
  1295. {
  1296. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  1297. return;
  1298. }
  1299. // 2.2.获取订单号;
  1300. BOOL bOfmat = 0;
  1301. CString strOrderNumber = m_FurtherList.GetItemText(iItem, 0 + m_nAdd); // 订单号;
  1302. CString branch;
  1303. if (g_bAllBranch)
  1304. branch = m_FurtherList.GetItemText(iItem, 0);
  1305. CString name1 = m_FurtherList.GetItemText(iItem, 1 + m_nAdd);
  1306. CString name2 = m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  1307. // 3.1.选片成长套系对话框;
  1308. IsGrowthTx growthtxdlg;
  1309. growthtxdlg.m_mode = 1;
  1310. growthtxdlg.m_strOrderNumber = strOrderNumber;
  1311. growthtxdlg.DoModal(); // 非成长套系的,直接退出;
  1312. BOOL m_bGrowthTX = growthtxdlg.m_bGrowthTx;
  1313. CString m_seltxname = growthtxdlg.m_seltxname;
  1314. #ifdef CHILD_VERSION
  1315. CString filter = "id='" + strOrderNumber + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底'";
  1316. if (m_seltxname != "" && m_seltxname != "全部")
  1317. {
  1318. filter = "id='" + strOrderNumber + "' and growthtxname='" + m_seltxname + "';id='" + strOrderNumber + "';id='" + strOrderNumber + "' and name<>'入册' and name<>'入底'";
  1319. }
  1320. #else
  1321. CString filter="id='"+strOrderNumber+"';id='"+strOrderNumber+"';id='"+strOrderNumber+"' and kind<>'2' and name<>'入册' and name<>'入底'";
  1322. #endif //#ifdef CHILD_VERSION
  1323. g_sendhead.bsql = 0;
  1324. g_sendhead.code[0] = 50; // dindansp
  1325. g_sendhead.code[1] = 11; // dindan
  1326. g_sendhead.code[2] = 56; // dindansp
  1327. g_sendhead.tabcount = 3;
  1328. if (g_bAllBranch)
  1329. {
  1330. g_branchip = GetIP(branch);
  1331. g_pMainWnd->OnDisconnect();
  1332. g_branchname = branch;
  1333. g_bBranchModify = 1;
  1334. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1335. g_pMainWnd->OnDisconnect();
  1336. g_bBranchModify = 0;
  1337. g_branchip = g_branchname = "";
  1338. }
  1339. else
  1340. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1341. if (g_bSendOK == 0)return;
  1342. CArray<CStringArray, CStringArray>sparray;
  1343. CArray<CStringArray, CStringArray>sparray2;
  1344. DataToArray(&sparray, &g_List1array, &sparray2);
  1345. CString strSrcDiretory; // 相片源目录;
  1346. if (g_bAllBranch)
  1347. {
  1348. CString branchpath = GetBranchPhotoPath(branch);
  1349. strSrcDiretory = g_path2 + branchpath + "\\";
  1350. }
  1351. else
  1352. strSrcDiretory = g_path2 + "\\";
  1353. // 4.照片类型选择对话框;(客户原片、初修片)
  1354. SelectPhotoDlg selectdlg;
  1355. selectdlg.DoModal();
  1356. strSrcDiretory += strOrderNumber;
  1357. strSrcDiretory += "\\";
  1358. if (m_seltxname != "" && m_seltxname != "全部")
  1359. {
  1360. strSrcDiretory += m_seltxname;
  1361. strSrcDiretory += "\\";
  1362. }
  1363. ////////////////////////////////////////
  1364. CString str, spname;
  1365. CStringArray noarray;
  1366. CStringArray spnamearray;
  1367. for (int i = 0; i < sparray.GetSize(); i++)
  1368. {
  1369. str = sparray.ElementAt(i).ElementAt(6); // 选好的片的相片名串;
  1370. spname = sparray.ElementAt(i).ElementAt(5); // 选好的片对应的商品名;
  1371. GetNo(str, noarray);
  1372. }
  1373. /*
  1374. for(int k=0; k<noarray; k++)
  1375. printf("no str=%s\n", noarray.ElementAt(k));
  1376. */
  1377. if (noarray.GetSize() == 0)
  1378. {
  1379. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  1380. return;
  1381. }
  1382. spnamearray.SetSize(noarray.GetSize());
  1383. for (i = 0; i < noarray.GetSize(); i++)
  1384. {
  1385. str = noarray.ElementAt(i);
  1386. spnamearray.SetAt(i, GetSelName(str, sparray));//+"-"+str );
  1387. }
  1388. CString strSaveDiretory; // 导出选好片的目录;
  1389. GetSavePath(strSaveDiretory);
  1390. if (strSaveDiretory.IsEmpty())return;
  1391. strSaveDiretory.TrimRight('\\');
  1392. strSaveDiretory += "\\";
  1393. strSaveDiretory += strOrderNumber;
  1394. strSaveDiretory += g_branchname;
  1395. if (g_bAllBranch)
  1396. {
  1397. if (GetBranchPhotoPath(branch) != "")
  1398. strSaveDiretory += branch;
  1399. }
  1400. strSaveDiretory += name1;
  1401. strSaveDiretory += name2;
  1402. strSaveDiretory += "选片";
  1403. strSaveDiretory += "\\";
  1404. CStringArray array;
  1405. CStringArray spnamearray2;
  1406. CString src, des;
  1407. // printf("m_mode = %d, m_seltxname = %s, m_bGrowthTX = %d, SrcDir = %s\n", selectdlg.m_mode, m_seltxname, m_bGrowthTX, strSrcDiretory);
  1408. if (selectdlg.m_mode == 0)
  1409. {
  1410. for (i = 0; i < noarray.GetSize(); i++)
  1411. {
  1412. if ((m_seltxname != "" && m_seltxname != "全部") || m_bGrowthTX == 0)
  1413. src.Format("%s%s.jpg", strSrcDiretory, noarray.ElementAt(i));
  1414. else
  1415. src = GetPathFromNo3(strSrcDiretory, noarray.ElementAt(i));
  1416. // printf("src1 = %s\n", src);
  1417. if (PathFileExists(src))
  1418. {
  1419. // printf("exists src = %s\n", src);
  1420. array.Add(src);
  1421. if (1)//selectdlg.m_check1)
  1422. spnamearray2.Add(spnamearray.ElementAt(i));
  1423. else
  1424. spnamearray2.Add(noarray.ElementAt(i));
  1425. }
  1426. else
  1427. AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  1428. }
  1429. }
  1430. // printf("arraySize1 = %d\n", array.GetSize());
  1431. if (array.GetSize() == 0)
  1432. {
  1433. if (selectdlg.m_mode == 0)
  1434. AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
  1435. if (g_bAllBranch)
  1436. {
  1437. CString branchpath = GetBranchPhotoPath(branch);
  1438. strSrcDiretory = g_path1 + branchpath + "\\";
  1439. }
  1440. else
  1441. strSrcDiretory = g_path1 + "\\";
  1442. strSrcDiretory += strOrderNumber;
  1443. strSrcDiretory += "\\";
  1444. strSaveDiretory.Delete(strSaveDiretory.GetLength() - 1, 1);
  1445. strSaveDiretory += "(未修)\\";
  1446. bOfmat = 1;
  1447. for (i = 0; i < noarray.GetSize(); i++)
  1448. {
  1449. // src.Format ("%s%s.jpg", strSrcDiretory, noarray.ElementAt (i));
  1450. src = GetPathFromNo2(strSrcDiretory, noarray.ElementAt(i));
  1451. // printf("src2 = %s\n", src);
  1452. if (PathFileExists(src))
  1453. {
  1454. // printf("exists src = %s\n", src);
  1455. array.Add(src);
  1456. if (1)//selectdlg.m_check1)
  1457. spnamearray2.Add(spnamearray.ElementAt(i));
  1458. else
  1459. spnamearray2.Add(noarray.ElementAt(i));
  1460. }
  1461. else
  1462. AfxMessageBox("未找到原片文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  1463. }
  1464. }
  1465. // printf("arraySize2 = %d\n", array.GetSize());
  1466. if (array.GetSize() == 0)
  1467. {
  1468. AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
  1469. return;
  1470. }
  1471. ::CreateDirectory(strSaveDiretory, NULL);
  1472. #endif //#if USE_SHARE_FLORD
  1473. // 3.导出相片处理对象;
  1474. ImportPhoto dlg;
  1475. dlg.m_name = name1 + name2;
  1476. #if USE_SHARE_FLORD
  1477. dlg.m_bAddname = bExportWithName;
  1478. #else
  1479. dlg.m_bAddname = selectdlg.m_check1;
  1480. #endif
  1481. dlg.m_bOfmat = bOfmat;
  1482. dlg.m_mode = 1;
  1483. dlg.m_bOrigin = 1;
  1484. dlg.m_pArray = &array;
  1485. dlg.m_pArray2 = &spnamearray2;
  1486. dlg.m_savepath = strSaveDiretory;
  1487. dlg.DoModal();
  1488. //////////////
  1489. if (g_List1array.GetSize())
  1490. {
  1491. CStdioFile fp;
  1492. fp.Open(strSaveDiretory + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
  1493. fp.WriteString("选片要求:\n");
  1494. fp.WriteString(g_List1array.ElementAt(0).ElementAt(39) + " " + g_List1array.ElementAt(0).ElementAt(75));
  1495. fp.WriteString("\n");
  1496. fp.WriteString("\n");
  1497. fp.WriteString("订单要求:\n");
  1498. fp.WriteString(g_List1array.ElementAt(0).ElementAt(38));
  1499. fp.WriteString("\n");
  1500. fp.WriteString("\n");
  1501. fp.WriteString("客人产品:\n");
  1502. CString str;
  1503. str = "产品名称";
  1504. FillLength(str, 30);
  1505. str += "数量";
  1506. FillLength(str, 40);
  1507. #ifdef LKAY_VERSION
  1508. str += "P数";
  1509. FillLength(str, 50);
  1510. str += "加急";
  1511. FillLength(str, 60);
  1512. str += "取件日期";
  1513. FillLength(str, 70);
  1514. #else
  1515. str += "加急";
  1516. FillLength(str, 50);
  1517. str += "取件日期";
  1518. FillLength(str, 60);
  1519. #endif
  1520. fp.WriteString(str);
  1521. fp.WriteString("\n");
  1522. for (int i = 0; i < sparray2.GetSize(); i++)
  1523. {
  1524. str.Empty();
  1525. str = sparray2.ElementAt(i).ElementAt(0);
  1526. FillLength(str, 30);
  1527. str += sparray2.ElementAt(i).ElementAt(1);
  1528. FillLength(str, 40);
  1529. #ifdef LKAY_VERSION
  1530. str += sparray2.ElementAt(i).ElementAt(29);//p数
  1531. FillLength(str, 50);
  1532. str += sparray2.ElementAt(i).ElementAt(18);
  1533. FillLength(str, 60);
  1534. str += sparray2.ElementAt(i).ElementAt(19);
  1535. FillLength(str, 70);
  1536. #else
  1537. str += sparray2.ElementAt(i).ElementAt(18);
  1538. FillLength(str, 50);
  1539. str += sparray2.ElementAt(i).ElementAt(19);
  1540. FillLength(str, 60);
  1541. #endif
  1542. fp.WriteString(str);
  1543. fp.WriteString("\n");
  1544. }
  1545. fp.Close();
  1546. }
  1547. //////////////
  1548. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1549. #if JEFF_TEST_ON // 导出裁剪效果图;
  1550. //strSrcDiretory; // 源相片目录;
  1551. //strSaveDiretory;// 导出选好片的目录;
  1552. if (FALSE == g_List1array.ElementAt(0).ElementAt(60).IsEmpty())
  1553. #if USE_SHARE_FLORD
  1554. ;
  1555. #else
  1556. // 使用多级共享目录,需要重写该函数;
  1557. ExportCutImageToFile(g_List1array.ElementAt(0).ElementAt(60), strSrcDiretory, strSaveDiretory+_T("裁剪效果\\"));
  1558. #endif
  1559. #else
  1560. {
  1561. ShowCut dlg;
  1562. dlg.m_branch = branch;
  1563. dlg.m_mode = 1;
  1564. dlg.m_id = strOrderNumber;
  1565. dlg.DoModal();
  1566. }
  1567. #endif
  1568. CString strlog;
  1569. strlog = " 导出选片 ";
  1570. strlog += "客人:";
  1571. strlog += name1 + name2 + strOrderNumber;
  1572. WriteLog(_T("精修导出选好的片"), strlog);
  1573. #endif
  1574. }
  1575. void BeautifySkinFrom2::OnBUTexportphoto2() // 导出精修的片 按钮;
  1576. {
  1577. #ifdef USE_KERNEL_DLL
  1578. // 判断登陆用户是否有导出原片的权限;
  1579. if ( !IsHasRights2new(11) )
  1580. {
  1581. AfxMessageBox(_T("您无权限导出原片!"),MB_ICONINFORMATION);
  1582. return;
  1583. }
  1584. // 获取列表信息:域名、订单号、景点名、顾客信息;
  1585. POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
  1586. if ( pos == NULL )
  1587. {
  1588. AfxMessageBox(_T("请选中您要导出原片的订单!"), MB_ICONINFORMATION);
  1589. return;
  1590. }
  1591. INT nItemCount = m_FurtherList.GetItemCount();
  1592. INT nSelectedItem = m_FurtherList.GetNextSelectedItem(pos);
  1593. CString strBranchId = _T("");
  1594. CString strOrderNum = _T("");
  1595. // 初修列表不支持景点名,需要从其他地方获取;
  1596. CString strScenery = _T("");
  1597. CString strCustomerInfo = _T("");
  1598. // 获取域名;
  1599. if ( g_bAllBranch )
  1600. {// 多店汇总时;
  1601. strBranchId = GetDomainFromBranch( m_FurtherList.GetItemText(nSelectedItem, 0) );
  1602. }
  1603. else
  1604. {
  1605. if ( g_branchname.IsEmpty() )
  1606. {// 连接本店时;
  1607. strBranchId = g_domain;
  1608. }
  1609. else
  1610. {// 连接分店时;
  1611. strBranchId = GetDomainFromBranch( g_branchname );
  1612. }
  1613. }
  1614. // 获取订单号;
  1615. strOrderNum = m_FurtherList.GetItemText(nSelectedItem, 0 + m_nAdd);
  1616. // 获取顾客信息;
  1617. strCustomerInfo = m_FurtherList.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_FurtherList.GetItemText(nSelectedItem, 2 + m_nAdd);
  1618. // 获取景点名,需要读取dindanjd表获取,目前只支持儿童成长套系订单;
  1619. IsGrowthTx IsGrowthtxdlg;
  1620. IsGrowthtxdlg.m_mode = 1;
  1621. IsGrowthtxdlg.m_strOrderNumber = strOrderNum;
  1622. IsGrowthtxdlg.DoModal();
  1623. if( IsGrowthtxdlg.m_bReturnOK == 0 || (IsGrowthtxdlg.m_bGrowthTx && IsGrowthtxdlg.m_seltxname.IsEmpty()) )
  1624. {
  1625. return;
  1626. }
  1627. if ( IsGrowthtxdlg.m_bGrowthTx )
  1628. {
  1629. // 读取dindanjd表里的成长套系名,并返回选中的成长套系名;
  1630. strScenery = IsGrowthtxdlg.m_seltxname;
  1631. if ( strScenery == _T("全部") )
  1632. {
  1633. strScenery.Empty();
  1634. }
  1635. }
  1636. // 导出原片时,是否压缩导出;
  1637. DWORD dwExportPix = INVALID_COPY_PIX; // 通过其他对话框,选择导出时压缩的像素;
  1638. /////////////////////////////////////////////////////////////////////////////////////////////////
  1639. if ( g_pIMGProcess == NULL )
  1640. {
  1641. return ;
  1642. }
  1643. // 获取完信息,开始导出原片;
  1644. ImgExportInterface *pExport = NULL;
  1645. g_pIMGProcess->QueryInterface(IID_ImgExportInterface, (void**)&pExport);
  1646. if ( pExport )
  1647. {
  1648. pExport->ExportFurtherImg(
  1649. TRUE,
  1650. strBranchId,
  1651. strOrderNum,
  1652. strCustomerInfo,
  1653. !strScenery.IsEmpty(),
  1654. strScenery,
  1655. _T("*.jpg|*.jpeg"),
  1656. dwExportPix,
  1657. _T("*.nef|*.cr2|*.raw|*.ra2"),
  1658. FALSE,
  1659. FALSE
  1660. );
  1661. }
  1662. g_pIMGProcess->Release();
  1663. WriteOptLog(_T("导出精修,订单号:%s"),strOrderNum);
  1664. // 结束;
  1665. #else
  1666. if (IsHasRights2new(11) == 0)return;
  1667. POSITION pos;
  1668. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1669. if (pos == NULL)
  1670. {
  1671. AfxMessageBox("请先选中您要导出片的定单!", MB_ICONINFORMATION);
  1672. return;
  1673. }
  1674. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1675. CString id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  1676. #if USE_SHARE_FLORD
  1677. CString branch;
  1678. if(g_bAllBranch)
  1679. branch=m_FurtherList.GetItemText (iItem, 0);
  1680. CString strDomain = _T("");
  1681. CString savepath = _T("");
  1682. if (g_bAllBranch)
  1683. {
  1684. if(branch != _T(""))
  1685. strDomain = GetDomainFromBranch(branch);
  1686. }
  1687. else
  1688. {
  1689. if(g_branchname != _T(""))
  1690. strDomain = GetDomainFromBranch(g_branchname);
  1691. }
  1692. // 导出原片时,可以选择只导出单独的景点相片;(如果是儿童版的成长套系,可以导出某个套系的相片)
  1693. // 得到源相片;
  1694. CStringArray array;
  1695. CNetShareInfo::GetInstance()->LoadOrderImages(3, id, strDomain,array);
  1696. // printf("size=%d\n", array.GetSize());
  1697. if(array.GetSize ()==0)
  1698. {
  1699. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  1700. return;
  1701. }
  1702. // 获取保存的路径;
  1703. CString dir;
  1704. GetSavePath(dir);
  1705. if(dir.IsEmpty())
  1706. {
  1707. return;
  1708. }
  1709. CString name1=m_FurtherList.GetItemText (iItem, 1+m_nAdd);
  1710. CString name2=m_FurtherList.GetItemText (iItem, 2+m_nAdd);
  1711. dir.TrimRight ('\\');
  1712. dir+="\\";
  1713. dir+=id;
  1714. dir+=g_branchname;
  1715. if(g_bAllBranch)
  1716. {
  1717. if(GetBranchPhotoPath(branch)!="")
  1718. dir+=branch;
  1719. }
  1720. dir+=name1;
  1721. dir+=name2;
  1722. dir+="精修好的片";
  1723. dir+="\\";
  1724. ::CreateDirectory (dir, NULL);
  1725. // 新的相片路径;
  1726. int nIndex = 0;
  1727. CString strTemp;
  1728. CStringArray desarray;
  1729. for ( int i = 0; i < array.GetSize(); i++ )
  1730. {
  1731. // 获取到订单号以后的路径字符;
  1732. strTemp = array.ElementAt(i).Mid(array.ElementAt(i).Find(id) + id.GetLength() + 1 );
  1733. desarray.Add(dir + strTemp);
  1734. if ( (nIndex = strTemp.Find("\\")) != -1 )
  1735. {
  1736. strTemp = strTemp.Left( nIndex + 1 );
  1737. CreateDirectory(dir + strTemp, NULL);
  1738. }
  1739. }
  1740. #else
  1741. CString branch;
  1742. if (g_bAllBranch)
  1743. branch = m_FurtherList.GetItemText(iItem, 0);
  1744. CString path;
  1745. if (g_bAllBranch)
  1746. {
  1747. CString branchpath = GetBranchPhotoPath(branch);
  1748. path = g_path4 + branchpath + "\\";
  1749. }
  1750. else
  1751. path = g_path4 + "\\";
  1752. path += id;
  1753. path += "\\";
  1754. CStringArray array;
  1755. CString dir;
  1756. GetSavePath(dir);
  1757. if (dir.IsEmpty())
  1758. {
  1759. return;
  1760. }
  1761. CString name1 = m_FurtherList.GetItemText(iItem, 1 + m_nAdd);
  1762. CString name2 = m_FurtherList.GetItemText(iItem, 2 + m_nAdd);
  1763. dir.TrimRight('\\');
  1764. dir += "\\";
  1765. dir += id;
  1766. dir += g_branchname;
  1767. if (g_bAllBranch)
  1768. {
  1769. if (GetBranchPhotoPath(branch) != "")
  1770. dir += branch;
  1771. }
  1772. dir += name1;
  1773. dir += name2;
  1774. dir += "精修好的片";
  1775. dir += "\\";
  1776. ::CreateDirectory(dir, NULL);
  1777. CStringArray desarray;
  1778. CStringArray dirarray;
  1779. CString savepath = dir;
  1780. CString str;
  1781. if (1)
  1782. {
  1783. using namespace helper_coffs;
  1784. ffsco o;
  1785. o.dirs(1);
  1786. o.find(LPCSTR(path), LPCSTR("*.*"));
  1787. ffsco::typeT coo;
  1788. ffsco::typeT::iterator it;
  1789. coo = o.co_dir();
  1790. for (it = coo.begin();coo.end() != it;it++)
  1791. {
  1792. str = (*it).c_str();
  1793. if (FindArray(&dirarray, str) == -1)
  1794. {
  1795. dirarray.Add(str);
  1796. if (str != dirarray.ElementAt(0))
  1797. {
  1798. str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
  1799. if (::CheckFolderFileExist(str) == 0)
  1800. ::CreateDirectory(str, NULL);
  1801. }
  1802. }
  1803. }
  1804. }
  1805. if (1)
  1806. {
  1807. for (int i = 0; i < dirarray.GetSize(); i++)
  1808. {
  1809. using namespace helper_coffs;
  1810. ffsco o;
  1811. o.dirs(0);
  1812. o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
  1813. ffsco::typeT coo;
  1814. ffsco::typeT::iterator it;
  1815. coo = o.co_file();
  1816. for (it = coo.begin();coo.end() != it;it++)
  1817. {
  1818. str = (*it).c_str();
  1819. if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
  1820. if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
  1821. array.Add(str);
  1822. desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
  1823. }
  1824. }
  1825. }
  1826. if (array.GetSize() == 0)
  1827. {
  1828. AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
  1829. return;
  1830. }
  1831. #endif
  1832. CCompressOption comoptdlg;
  1833. comoptdlg.DoModal();
  1834. ImportPhoto dlg;
  1835. dlg.m_nOutputSize = comoptdlg.m_nsize;
  1836. dlg.m_mode = 1;
  1837. dlg.m_pArray = &array;
  1838. dlg.m_pDesArray = &desarray;
  1839. dlg.m_savepath = dir;
  1840. dlg.DoModal(); AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  1841. CString str;
  1842. str = " 导出精修片 ";
  1843. str += "客人:";
  1844. str += name1 + name2 + id;
  1845. WriteLog(_T("导出精修片"), str);
  1846. #endif
  1847. }
  1848. void BeautifySkinFrom2::OnButton1()
  1849. {
  1850. UpdateData();
  1851. m_filter.TrimLeft();
  1852. m_filter.TrimRight();
  1853. FillGrid();
  1854. }
  1855. void BeautifySkinFrom2::OnButton2() // 已选未修 按钮;
  1856. {
  1857. UpdateData();
  1858. m_filter.TrimLeft();
  1859. m_filter.TrimRight();
  1860. FillGrid(1);
  1861. }
  1862. void BeautifySkinFrom2::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
  1863. {
  1864. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  1865. POSITION pos;
  1866. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1867. if (pos == NULL)
  1868. {
  1869. return;
  1870. }
  1871. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1872. if (IsHasRights2new(6) || IsHasRights2new(49))
  1873. {
  1874. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1875. }
  1876. else
  1877. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
  1878. /* if(waiter7.IsEmpty () && IsHasRights2new(6) || IsHasRights2new(49))
  1879. {
  1880. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1881. }
  1882. else if(waiter7==g_user.name && IsHasRights2new(6) )
  1883. {
  1884. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
  1885. }
  1886. else
  1887. GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);*/
  1888. *pResult = 0;
  1889. }
  1890. void BeautifySkinFrom2::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult)
  1891. {
  1892. POSITION pos;
  1893. pos = m_FurtherList.GetFirstSelectedItemPosition();
  1894. if (pos == NULL)return;
  1895. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  1896. g_id = m_FurtherList.GetItemText(iItem, 0 + m_nAdd);
  1897. *pResult = 0;
  1898. }
  1899. void BeautifySkinFrom2::HidePrice()
  1900. {
  1901. #ifdef LKAY_VERSION
  1902. return;
  1903. #else
  1904. return;
  1905. #endif
  1906. }
  1907. void BeautifySkinFrom2::OnBtnsearchfilter()
  1908. {
  1909. SearchFilter dlg;
  1910. dlg.m_mode = 3;
  1911. if (dlg.DoModal() == IDOK)FillGrid();
  1912. g_bSearchFilter = 0;
  1913. }
  1914. void BeautifySkinFrom2::GetData()
  1915. {
  1916. if (g_bAllBranch == 0)
  1917. {
  1918. if (g_bShowOK == 0)
  1919. {
  1920. #ifdef LKAY_VERSION
  1921. CString filter = "status3='未取' and (dindantype<>'意向客户' or dindantype is null)";
  1922. #else
  1923. CString filter = "status3='未取'";
  1924. #endif
  1925. g_sendhead.bsql = 0;
  1926. g_sendhead.code[0] = 35;
  1927. g_sendhead.tabcount = 1;
  1928. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1929. if (g_bSendOK == 0)return;
  1930. }
  1931. else
  1932. {
  1933. g_sendhead.bsql = 0;
  1934. g_sendhead.code[0] = 35;
  1935. g_sendhead.tabcount = 1;
  1936. #ifdef LKAY_VERSION
  1937. CString filter = "dindantype<>'意向客户' or dindantype is null";
  1938. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1939. #else
  1940. g_pMainWnd->ProcessChatMessageRequest2(1);
  1941. #endif
  1942. if (g_bSendOK == 0)return;
  1943. }
  1944. DataToArray(&m_List1array);
  1945. }
  1946. else
  1947. {
  1948. //////////////数据汇总
  1949. m_List1array.RemoveAll();
  1950. CString branch;
  1951. for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
  1952. {
  1953. if (i != -1)
  1954. {
  1955. branch = g_brancharray.ElementAt(i).ElementAt(0);
  1956. g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
  1957. g_pMainWnd->OnDisconnect();
  1958. g_branchname = branch;
  1959. g_bBranchModify = 1;
  1960. }
  1961. else
  1962. branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
  1963. if (g_bShowOK == 0)
  1964. {
  1965. CString filter = "status3='未取'";
  1966. g_sendhead.bsql = 0;
  1967. g_sendhead.code[0] = 35;
  1968. g_sendhead.tabcount = 1;
  1969. g_pMainWnd->ProcessChatMessageRequest2(filter);
  1970. if (g_bSendOK == 0)continue;
  1971. }
  1972. else
  1973. {
  1974. g_sendhead.bsql = 0;
  1975. g_sendhead.code[0] = 35;
  1976. g_sendhead.tabcount = 1;
  1977. g_pMainWnd->ProcessChatMessageRequest2(1);
  1978. if (g_bSendOK == 0)continue;
  1979. }
  1980. CArray<CStringArray, CStringArray>List1array;
  1981. DataToArray(&List1array);
  1982. int size = m_List1array.GetSize();
  1983. for (int j = 0; j < List1array.GetSize(); j++)
  1984. {
  1985. size++;
  1986. m_List1array.SetSize(size, 1);
  1987. size--;
  1988. m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
  1989. m_List1array.ElementAt(size).InsertAt(0, branch);
  1990. size++;
  1991. }
  1992. }
  1993. g_pMainWnd->OnDisconnect();
  1994. g_bBranchModify = 0; g_branchip = g_branchname = "";
  1995. }
  1996. HidePrice();
  1997. FillGrid();
  1998. }
  1999. void BeautifySkinFrom2::OnBUTprint3()
  2000. {
  2001. GetData();
  2002. }
  2003. // Jeff.没看到调用的地方,也没有关联任何按钮控件.
  2004. // 应该是废弃的函数;
  2005. void BeautifySkinFrom2::OnBUTexportphotoAddName()
  2006. {
  2007. if (IsHasRights2new(10) == 0)return;
  2008. UpdateData();
  2009. POSITION pos;
  2010. pos = m_FurtherList.GetFirstSelectedItemPosition();
  2011. if (pos == NULL)
  2012. {
  2013. AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
  2014. return;
  2015. }
  2016. int iItem = m_FurtherList.GetNextSelectedItem(pos);
  2017. CString status2 = m_FurtherList.GetItemText(iItem, 4);
  2018. if (status2 != "OK")
  2019. {
  2020. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  2021. return;
  2022. }
  2023. CString id = m_FurtherList.GetItemText(iItem, 0);
  2024. CString name1 = m_FurtherList.GetItemText(iItem, 1);
  2025. CString name2 = m_FurtherList.GetItemText(iItem, 2);
  2026. CString filter = "id='" + id + "';id='" + id + "'";
  2027. g_sendhead.bsql = 0;
  2028. g_sendhead.code[0] = 50;
  2029. g_sendhead.code[1] = 11;
  2030. g_sendhead.tabcount = 2;
  2031. g_pMainWnd->ProcessChatMessageRequest2(filter);
  2032. if (g_bSendOK == 0)return;
  2033. CArray<CStringArray, CStringArray>sparray;
  2034. DataToArray(&sparray, &g_List1array);
  2035. CString path = g_path2 + "\\";
  2036. SelectPhotoDlg selectdlg;
  2037. selectdlg.DoModal();
  2038. path += id;
  2039. path += "\\";
  2040. ////////////////////////////////////////
  2041. CString str, spname;
  2042. CStringArray noarray;
  2043. CStringArray spnamearray;
  2044. int i = 0;
  2045. for ( i = 0; i < sparray.GetSize(); i++)
  2046. {
  2047. str = sparray.ElementAt(i).ElementAt(6);
  2048. spname = sparray.ElementAt(i).ElementAt(5);
  2049. GetNo(str, noarray);
  2050. }
  2051. if (noarray.GetSize() == 0)
  2052. {
  2053. AfxMessageBox("此单未选片!", MB_ICONINFORMATION);
  2054. return;
  2055. }
  2056. spnamearray.SetSize(noarray.GetSize());
  2057. for (i = 0; i < noarray.GetSize(); i++)
  2058. {
  2059. str = noarray.ElementAt(i);
  2060. spnamearray.SetAt(i, GetSelName(str, sparray) + "-" + str);
  2061. }
  2062. CString dir;
  2063. GetSavePath(dir);
  2064. if (dir.IsEmpty())return;
  2065. dir.TrimRight('\\');
  2066. dir += "\\";
  2067. dir += id;
  2068. dir += name1;
  2069. dir += name2;
  2070. dir += "选片";
  2071. dir += "\\";
  2072. CStringArray array;
  2073. CStringArray spnamearray2;
  2074. CString src, des;
  2075. //selectdlg.m_mode: 1=原片 2=初修 0=初修+原片
  2076. if (selectdlg.m_mode == 2)
  2077. {
  2078. for (i = 0; i < noarray.GetSize(); i++)
  2079. {
  2080. src.Format("%s%s.jpg", path, noarray.ElementAt(i));
  2081. if (::CheckFolderFileExist(src))
  2082. {
  2083. array.Add(src);
  2084. if (selectdlg.m_check1)
  2085. spnamearray2.Add(spnamearray.ElementAt(i));
  2086. else
  2087. spnamearray2.Add(noarray.ElementAt(i));
  2088. }
  2089. else
  2090. AfxMessageBox("未找到初修过的文件:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
  2091. }
  2092. }
  2093. if (array.GetSize() == 0)
  2094. {
  2095. if (selectdlg.m_mode == 2)
  2096. AfxMessageBox("注意:此单未修片, 导出的是原片!", MB_ICONINFORMATION);
  2097. path = g_path1 + "\\";
  2098. path += id;
  2099. path += "\\";
  2100. dir.Delete(dir.GetLength() - 1, 1);
  2101. dir += "(未修)\\";
  2102. for (i = 0; i < noarray.GetSize(); i++)
  2103. {
  2104. src = GetPathFromNo2(path, noarray.ElementAt(i));
  2105. if (PathFileExists(src))
  2106. {
  2107. array.Add(src);
  2108. if (selectdlg.m_check1)
  2109. spnamearray2.Add(spnamearray.ElementAt(i));
  2110. else
  2111. spnamearray2.Add(noarray.ElementAt(i));
  2112. }
  2113. }
  2114. }
  2115. if (array.GetSize() == 0)
  2116. {
  2117. AfxMessageBox("此单未导入原片!", MB_ICONINFORMATION);
  2118. return;
  2119. }
  2120. ::CreateDirectory(dir, NULL);
  2121. ImportPhoto dlg;
  2122. dlg.m_mode = 1;
  2123. dlg.m_pArray = &array;
  2124. dlg.m_pArray2 = &spnamearray2;
  2125. dlg.m_savepath = dir;
  2126. dlg.DoModal();
  2127. //////////////
  2128. if (g_List1array.GetSize())
  2129. {
  2130. CStdioFile fp;
  2131. fp.Open(dir + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
  2132. fp.WriteString(g_List1array.ElementAt(0).ElementAt(39));
  2133. fp.Close();
  2134. }
  2135. //////////////
  2136. AfxMessageBox("导片成功!", MB_ICONINFORMATION);
  2137. }
  2138. #if USE_SHARE_FLORD
  2139. /************************************************************************/
  2140. /*
  2141. 函数:GetCurSelRecord
  2142. 描述:获取当前List列表选中的项记录;
  2143. 参数:
  2144. OUT:strName1 选中项的顾客1姓名;
  2145. OUT:strName2 选中项的顾客2姓名;
  2146. OUT:strOrderNum 选中项的订单号;
  2147. OUT:strDomain 选中项的所在分店域名,本店为空;
  2148. 返回:
  2149. 调用约定:
  2150. 注意:
  2151. */
  2152. /************************************************************************/
  2153. void BeautifySkinFrom2::GetCurSelRecord(
  2154. OUT CString &strName1,
  2155. OUT CString &strName2,
  2156. OUT CString &strOrderNum,
  2157. OUT CString &strBranch,
  2158. OUT CString &strDomain)
  2159. {
  2160. UpdateData();
  2161. // 获取所中行;
  2162. POSITION pos = m_FurtherList.GetFirstSelectedItemPosition();
  2163. if ( pos == NULL)
  2164. {
  2165. AfxMessageBox(_T("请先选中您要导片的定单!"), MB_ICONINFORMATION);
  2166. return;
  2167. }
  2168. int nItem = m_FurtherList.GetNextSelectedItem(pos);
  2169. // 获取选片状态, m_nAdd作用?;
  2170. CString strStatus = m_FurtherList.GetItemText(nItem,4 + m_nAdd);
  2171. if ( strStatus != _T("OK") )
  2172. {
  2173. AfxMessageBox(_T("此单未选片!"), MB_ICONINFORMATION);
  2174. return;
  2175. }
  2176. strOrderNum = m_FurtherList.GetItemText(nItem, 0 + m_nAdd);
  2177. strName1 = m_FurtherList.GetItemText(nItem, 1 + m_nAdd);
  2178. strName2 = m_FurtherList.GetItemText(nItem, 2 + m_nAdd);
  2179. if ( g_bAllBranch )
  2180. {
  2181. // 多店汇总时;
  2182. strBranch = m_FurtherList.GetItemText(nItem, 0);
  2183. strDomain = GetDomainFromBranch(strBranch);
  2184. }
  2185. else
  2186. {
  2187. if(g_branchname != _T(""))
  2188. {
  2189. strBranch = g_branchname;
  2190. strDomain = GetDomainFromBranch(g_branchname);
  2191. }
  2192. }
  2193. }
  2194. /************************************************************************/
  2195. /*
  2196. 函数:GetImageWithGoods
  2197. 描述:获取每张相片对应的商品串;
  2198. 参数:
  2199. IN: strBranch 分店名(多店汇总时)
  2200. IN: strDomain 分店域名(多店汇总或分店连接时);
  2201. IN: strOrderNum 订单号;
  2202. OUT: bGrowth 是否是儿童套系;
  2203. OUT: strSelGrowth 若bGrowth为TRUE,则这里为选中的成长套系名称;
  2204. OUT: bExportWithName 导出选好的片是否带商品名;
  2205. OUT: strAryOfImagePath 选中的相片路径;
  2206. OUT: strEachImageOfGoods与strAryOfImagePath元素位置对应,每一个元素都是strAryOfImagePath元素的商品表(用分号隔开);
  2207. 返回:返回导出的相片类型,== -1 无相片, 1 == 原片,0 == 初修片, 3 == 无初修,使用原片, //== 4 选择的是原片,但原片空....
  2208. 调用约定:
  2209. 注意:
  2210. */
  2211. /************************************************************************/
  2212. int BeautifySkinFrom2::GetImageWithGoods(
  2213. IN CString &strBranch,
  2214. IN CString &strDomain,
  2215. IN CString &strOrderNum,
  2216. OUT BOOL &bGrowth,
  2217. OUT CString &strSelGrowth,
  2218. OUT BOOL &bExportWithName,
  2219. OUT CStringArray &strAryOfImagePath,
  2220. OUT CStringArray &strAryOfEachImageOfGoods,
  2221. OUT CArray<CStringArray, CStringArray> &sparray2)
  2222. {
  2223. // 若是儿童成长套系,则弹出选项框;
  2224. CStringArray strAryOfScenery;
  2225. IsGrowthTx growthtxdlg;
  2226. growthtxdlg.m_mode = 1;
  2227. growthtxdlg.m_pAryOfScenery = &strAryOfScenery;
  2228. growthtxdlg.m_strOrderNumber = strOrderNum;
  2229. growthtxdlg.DoModal();
  2230. bGrowth = growthtxdlg.m_bGrowthTx;
  2231. strSelGrowth = growthtxdlg.m_seltxname;
  2232. // 与服务器通信获取指定条件的订单商品信息;
  2233. CString strFilter = _T("");
  2234. #ifdef CHILD_VERSION
  2235. if ( !strSelGrowth.IsEmpty() && strSelGrowth != _T("全部") )
  2236. {
  2237. strFilter.Format(_T("id='%s' and growthtxname = '%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strSelGrowth, strOrderNum, strOrderNum);
  2238. }
  2239. else
  2240. {
  2241. strFilter.Format(_T("id='%s'; id='%s'; id='%s' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
  2242. }
  2243. #else
  2244. strFilter.Format(_T("id='%s'; id='%s'; id='%s' and kind <> '2' and name <> '入册' and name <> '入底'"), strOrderNum, strOrderNum, strOrderNum);
  2245. #endif
  2246. g_sendhead.bsql = 0;
  2247. g_sendhead.code[0] = 50;
  2248. g_sendhead.code[1] = 11;
  2249. g_sendhead.code[2] = 56;
  2250. g_sendhead.tabcount = 3;
  2251. if( !g_bAllBranch )
  2252. {
  2253. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  2254. }
  2255. else
  2256. {
  2257. g_branchip = GetIP(strBranch);
  2258. g_pMainWnd->OnDisconnect();
  2259. g_branchname = strBranch;
  2260. g_bBranchModify = 1;
  2261. g_pMainWnd->ProcessChatMessageRequest2(strFilter);
  2262. g_pMainWnd->OnDisconnect();
  2263. g_bBranchModify = 0;
  2264. g_branchip = g_branchname = _T("");
  2265. }
  2266. if( !g_bSendOK )
  2267. return -1;
  2268. CArray<CStringArray, CStringArray> sparray;
  2269. //CArray<CStringArray, CStringArray> sparray2;
  2270. DataToArray( &sparray, &g_List1array, &sparray2 );
  2271. CString strTemp;
  2272. CStringArray strAryOfImageNum; // 所有相片的数字编号;
  2273. // 获取所有dindansp记录no字段中的相片编号;
  2274. int i = 0;
  2275. int nSize = sparray.GetSize();
  2276. for ( i = 0; i < nSize; i++)
  2277. {
  2278. strTemp = sparray.ElementAt(i).ElementAt(6); // dindansp表中的no字段;
  2279. // WriteTextLog(_T("no:") + strTemp);
  2280. GetNo(strTemp, strAryOfImageNum);
  2281. }
  2282. if ( strAryOfImageNum.GetSize() == 0 )
  2283. {
  2284. AfxMessageBox(_T("此单未选片!"),MB_ICONINFORMATION);
  2285. return -1;
  2286. }
  2287. // 获取每个相片编号关联的商品集合,用分号隔开;
  2288. strAryOfEachImageOfGoods.SetSize(strAryOfImageNum.GetSize());
  2289. nSize = strAryOfImageNum.GetSize();
  2290. for( int n = 0; n < nSize; n++)
  2291. {
  2292. strTemp = strAryOfImageNum.ElementAt(n);
  2293. // WriteTextLog(_T("关联的号码:") + strTemp);
  2294. CString strspnames = GetSelName(strTemp, sparray);
  2295. // WriteTextLog(_T("关联的商品:") + strspnames);
  2296. strAryOfEachImageOfGoods.SetAt(n, strspnames);
  2297. }
  2298. CStringArray strTempImageGoods;
  2299. strTempImageGoods.Copy(strAryOfEachImageOfGoods);
  2300. SelectPhotoDlg selectdlg;
  2301. selectdlg.DoModal();
  2302. bExportWithName = selectdlg.m_check1;
  2303. int nPhotoType = selectdlg.m_mode; //mode模式:2.初修 1.原片 0.初修+原片 //相片类型1=原片 2=初修 3=精修 4=设计
  2304. // 遍历所有共享目录,查找相片路径;
  2305. CStringArray imagePathArr;
  2306. CStringArray imageNumArr;
  2307. imageNumArr.Copy(strAryOfImageNum);
  2308. if(nPhotoType == 0)
  2309. {
  2310. // printf(_T("原片+初修\n"));
  2311. for(i=2; i>0; --i)
  2312. {
  2313. imagePathArr.RemoveAll();
  2314. LoadExistsImagesEx(i, strDomain, strOrderNum, bGrowth, strSelGrowth, strAryOfScenery, imageNumArr, imagePathArr, strAryOfEachImageOfGoods);
  2315. if(strAryOfImagePath.GetSize() == 0)
  2316. strAryOfImagePath.Append(imagePathArr);
  2317. else
  2318. {
  2319. int nSize = strAryOfImagePath.GetSize();
  2320. for(int j=0; j<nSize; j++)
  2321. {
  2322. //去掉相同的相片
  2323. CString strName1 = strAryOfImagePath.ElementAt(j);
  2324. strName1 = strName1.Right(strName1.GetLength() - strName1.ReverseFind('\\') - 1);
  2325. for(int k=0; k<imagePathArr.GetSize(); k++)
  2326. {
  2327. CString strName2 = imagePathArr.ElementAt(k);
  2328. strName2 = strName2.Right(strName2.GetLength() - strName2.ReverseFind('\\') - 1);
  2329. if(strName1 == strName2)
  2330. {
  2331. imagePathArr.RemoveAt(k);
  2332. break;
  2333. }
  2334. }
  2335. }
  2336. if(imagePathArr.GetSize() > 0)
  2337. strAryOfImagePath.Append(imagePathArr);
  2338. }
  2339. }
  2340. }
  2341. else
  2342. {
  2343. LoadExistsImagesEx(nPhotoType, strDomain, strOrderNum, bGrowth, strSelGrowth, strAryOfScenery, imageNumArr, imagePathArr, strAryOfEachImageOfGoods);
  2344. if(imagePathArr.GetSize() > 0)
  2345. strAryOfImagePath.Copy(imagePathArr);
  2346. }
  2347. if ( strAryOfImagePath.GetSize() == 0 && nPhotoType == 2)
  2348. {
  2349. AfxMessageBox(_T("注意:此单未修片, 导出的是原片!"), MB_ICONINFORMATION);
  2350. nPhotoType = 1;
  2351. strAryOfImagePath.RemoveAll();
  2352. strAryOfEachImageOfGoods.RemoveAll();
  2353. strAryOfEachImageOfGoods.Copy(strTempImageGoods);
  2354. LoadExistsImagesEx(nPhotoType,strDomain,strOrderNum,bGrowth,strSelGrowth,strAryOfScenery,imageNumArr,imagePathArr,strAryOfEachImageOfGoods);
  2355. if(imagePathArr.GetSize() > 0)
  2356. strAryOfImagePath.Append(imagePathArr);
  2357. return strAryOfImagePath.GetSize() ? 3 : -1;
  2358. }
  2359. //按编号排序
  2360. CStringArray tempPathArr;
  2361. tempPathArr.Copy(strAryOfImagePath);
  2362. strAryOfImagePath.RemoveAll();
  2363. for(int j=0; j<imageNumArr.GetSize(); j++)
  2364. {
  2365. BOOL bExists = FALSE;
  2366. CString strNum = imageNumArr.ElementAt(j);
  2367. for(i=0; i<tempPathArr.GetSize(); i++)
  2368. {
  2369. CString strFile = tempPathArr.ElementAt(i);
  2370. strFile = strFile.Mid(strFile.ReverseFind('\\')+1);
  2371. int nPos = strFile.Find(_T("."));
  2372. if(nPos == -1)
  2373. continue;
  2374. strFile = strFile.Left(nPos);
  2375. if(strNum.CompareNoCase(strFile) == 0)
  2376. {
  2377. strAryOfImagePath.Add(tempPathArr.ElementAt(i));
  2378. bExists = TRUE;
  2379. break;
  2380. }
  2381. }
  2382. if(!bExists)
  2383. strAryOfImagePath.Add(_T(""));
  2384. }
  2385. return strAryOfImagePath.GetSize() ? selectdlg.m_mode : -1;
  2386. }
  2387. /************************************************************************/
  2388. /*
  2389. 函数:LoadExistsImagesEx
  2390. 描述:加载存在的相片编号文件;
  2391. 参数:
  2392. IN:nPhotoType 导出的相片类型;
  2393. IN:lpDomain 域名;
  2394. IN:lpOrderNum 订单号;
  2395. IN:bGrowTh 是否儿童成长套系;
  2396. IN:lpSelectName 选中的成长套系名;
  2397. IN:strAryOfScenery 订单下的景点名或儿童成长套系名数组;
  2398. IN:strAryOfImageNum 订单选好商品的相片编号数组;
  2399. OUT:strAryOfImagePath 存在于共享目录的相片编号文件路径数组;
  2400. OUT:strAryOfImageGoods 存在于共享目录的相片关联的商品数组;
  2401. 返回:
  2402. 调用约定:
  2403. 注意:
  2404. */
  2405. /************************************************************************/
  2406. void BeautifySkinFrom2::LoadExistsImagesEx(IN const int &nPhotoType,
  2407. IN LPCTSTR lpDomain,
  2408. IN LPCTSTR lpOrderNum,
  2409. IN BOOL bGrowTh,
  2410. IN LPCTSTR lpSelectName,
  2411. IN CStringArray &strAryOfScenery,
  2412. IN CStringArray &strAryOfImageNum,
  2413. OUT CStringArray &strAryOfImagePath,
  2414. OUT CStringArray &strAryOfImageGoods)
  2415. {
  2416. CStringArray strTempNum; //临时相片编号如:001,002
  2417. strTempNum.Copy(strAryOfImageNum);
  2418. CStringArray strTempImagePath; //临时相片路径集
  2419. //根据选好的相片编号查找
  2420. CNetShareInfo::GetInstance()->LoadOrderBySelectedImages(nPhotoType, lpOrderNum, lpDomain, strTempNum, strTempImagePath);
  2421. CString strScenery(lpSelectName);
  2422. /*
  2423. printf("-----bGrowTh = %d---------------strScenery = %s--------------------\n", bGrowTh, lpSelectName);
  2424. */
  2425. if ( bGrowTh && ( !strScenery.IsEmpty() && strScenery != _T("全部")) )
  2426. {
  2427. // 保留套系名下的相片;
  2428. CString str;
  2429. if ( nPhotoType == 1 )
  2430. {
  2431. // 原片;
  2432. for ( int i = 0; i < strTempImagePath.GetSize(); i++)
  2433. {
  2434. str = strTempImagePath.ElementAt(i);
  2435. str = str.Mid(str.Find(lpOrderNum) + strlen(lpOrderNum) + 1);
  2436. str = str.Left(str.Find('\\'));
  2437. if ( str.CompareNoCase(strScenery) == 0 )
  2438. {
  2439. strAryOfImagePath.Add(strTempImagePath.ElementAt(i));
  2440. }
  2441. }
  2442. }
  2443. else
  2444. {
  2445. // 初修;
  2446. for ( int i = 0; i < strTempImagePath.GetSize(); i++)
  2447. {
  2448. str = strTempImagePath.ElementAt(i);
  2449. int nIndex = str.Find(lpOrderNum);
  2450. str.Insert(nIndex + strlen(lpOrderNum) + 1, strScenery + _T("\\"));
  2451. if ( PathFileExists(str) )
  2452. strAryOfImagePath.Add(strTempImagePath.ElementAt(i));
  2453. }
  2454. }
  2455. }
  2456. else
  2457. {
  2458. /*
  2459. for(int i=0; i<strTempImagePath.GetSize(); )
  2460. {
  2461. CString strPath = strTempImagePath.ElementAt(i);
  2462. strPath = strPath.Right(strPath.GetLength() - strPath.ReverseFind('\\') - 1);
  2463. strPath = strPath.Left(strPath.Find('.'));
  2464. printf("strPath = %s\n", strPath);
  2465. if(FindArray(&strTempNum, strPath) == -1)
  2466. {
  2467. printf("remove = %s\n", strTempImagePath.ElementAt(i));
  2468. strTempImagePath.RemoveAt(i);
  2469. }
  2470. else
  2471. i++;
  2472. }
  2473. */
  2474. strAryOfImagePath.Copy(strTempImagePath);
  2475. }
  2476. /*test
  2477. for(int i=0; i<strAryOfImagePath.GetSize(); i++)
  2478. printf("path10 = %s\n", strAryOfImagePath.ElementAt(i));
  2479. */
  2480. }
  2481. #endif