DesignFrom.cpp 69 KB

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