DesignFrom.cpp 71 KB

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