导入导出函数.cpp 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755
  1. /************************************************************************/
  2. /////////////////////////////////////////////////////////////////////////
  3. // 在项目的stdAfx.h头文件中声明下列代码:
  4. // stdAfx.h
  5. #include "basetype.h"
  6. #include "TblDef.h"
  7. #include "filekernel.h"
  8. #include "Imgkernel.h"
  9. extern ImgEnvInterface* CreateIMGProcess( );
  10. extern ImgEnvInterface *g_pIMSProcess;
  11. /////////////////////////////////////////////////////////////////////////
  12. // 在项目的stdAfx.cpp中,实现定义;
  13. // stdAfx.cpp
  14. typedef ImgEnvInterface* (*CREATEIMGPROCESS)( );
  15. ImgEnvInterface* CreateIMGProcess( )
  16. { //加载动态库
  17. HMODULE hKernelDll = ( HMODULE )LoadLibrary( _T("kernel.dll") );
  18. if ( hKernelDll )
  19. {
  20. //获取创建接口的函数
  21. CREATEIMGPROCESS pInstance = (CREATEIMGPROCESS)GetProcAddress( hKernelDll, "CreateIMGProcess" );
  22. if ( pInstance )
  23. {
  24. //创建接口
  25. ImgEnvInterface * pIMGProcess = pInstance( );
  26. //返回接口
  27. return pIMGProcess;
  28. }
  29. }
  30. return NULL;
  31. }
  32. ImgEnvInterface *g_pIMSProcess = NULL;
  33. /************************************************************************/
  34. /************************************************************************/
  35. /////////////////////////////////////////////////////////////////////////
  36. // 在项目Global.h头文件中,定义下列结构体;
  37. // Global.h
  38. // 2015-10-10
  39. typedef struct _STSceneryInfo_
  40. {
  41. BOOL bSelected; // 被选中;
  42. CString strScenery; // 景点;
  43. CString strStatus; // 拍照状态;
  44. CString strTime; // 拍照时间;
  45. CString strLensman; // 摄影师;
  46. CString strLensmanAssistant; // 摄影师助理;
  47. CString strBootDivision; // 引导师;
  48. CString strBootDivisionAssistant; // 引导师;
  49. _STSceneryInfo_()
  50. {
  51. bSelected = FALSE;
  52. }
  53. }STSceneryInfo;
  54. typedef struct _STOrederInfo_
  55. {
  56. CString strBranchId; // 域名;
  57. CString strOrderNumber; // 订单号;
  58. CString strImageNumber; // 相片编号;
  59. CString strName1; // 顾客1;
  60. CString strName2; // 顾客2;
  61. CString strClerk; // 接单人;
  62. CString strPhone; // 手机;
  63. CString strTelPhone; // 座机;
  64. std::vector<STSceneryInfo> vtOrderScenery; // 订单景点;
  65. }STOrederInfo;
  66. // 程序实例;
  67. HINSTANCE g_Instance = NULL;
  68. // 在Global.cpp中声明;
  69. extern HINSTANCE g_Instance;
  70. /************************************************************************/
  71. // 需要在BOOL CYLGLApp::InitInstance()中添加下列代码段;
  72. BOOL CYLGLApp::InitInstance()
  73. {
  74. ...
  75. //////////////////////////////////////////////////////////////////////////
  76. // 2015.11.07
  77. g_Instance = AfxGetResourceHandle();
  78. g_pIMSProcess = CreateIMGProcess();
  79. ...
  80. }
  81. // 在BOOL CYLGLApp::ExitInstance()中添加下列代码代码段;
  82. int CYLGLApp::ExitInstance()
  83. {
  84. ...
  85. g_pIMSProcess->Release();
  86. ...
  87. }
  88. void Login3::Init()
  89. {
  90. ……
  91. if (g_branchname == "")
  92. {
  93. #if USE_SHARE_FLORD
  94. // 清空数组,并重新获取NetShareInfo表;
  95. g_aryOfSharePathInfo.RemoveAll();
  96. g_pMainWnd->GetSharePathInfo();
  97. // 300行左右
  98. g_pIMSProcess->SetEnvInfoEx(g_server, g_domain, &g_cominfoarray, &g_brancharray, &g_aryOfSharePathInfo);
  99. }
  100. ……
  101. }
  102. // 拍照;
  103. /************************************************************************/
  104. /*
  105. 函数:GetSelectedOrderInfo
  106. 描述:获取选中的列表项的订单信息;
  107. 参数:
  108. [OUT] tagOrderInfo
  109. [OUT] nFirstItem 第一个景点项索引;
  110. [OUT] nEndofItem 最后一个景点项索引;
  111. 返回:空
  112. 注意:
  113. 要求:
  114. 示例:
  115. 修改:
  116. 日期:
  117. 内容:
  118. */
  119. /************************************************************************/
  120. INT TakeFrom::GetSelectedOrderInfo( OUT STOrederInfo &tagOrderInfo, OUT INT& nFirstItem, OUT INT& nEndofItem )
  121. {
  122. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  123. if ( pos == NULL )
  124. {
  125. AfxMessageBox(_T("未选中要导入相片的订单!"),MB_ICONINFORMATION);
  126. return -1;
  127. }
  128. INT nItemCount = m_List1.GetItemCount();
  129. INT nSelectedItem = m_List1.GetNextSelectedItem(pos);
  130. //INT nFirstItem = 0; // 记录第一个景点项索引;
  131. //INT nEndofItem = 0; // 记录最后一个景点项索引;
  132. INT nSceneryItem = nSelectedItem;
  133. if ( m_List1.GetItemText(nSelectedItem, 0 + m_nAdd) == _T("") )
  134. {
  135. STSceneryInfo tagSceneryInfo;
  136. tagSceneryInfo.bSelected = TRUE;
  137. tagSceneryInfo.strScenery = m_List1.GetItemText(nSceneryItem, 4 + m_nAdd);
  138. tagSceneryInfo.strStatus = m_List1.GetItemText(nSceneryItem, 5 + m_nAdd);
  139. tagSceneryInfo.strTime = m_List1.GetItemText(nSceneryItem, 6 + m_nAdd);
  140. tagSceneryInfo.strLensman = m_List1.GetItemText(nSceneryItem, 7 + m_nAdd);
  141. tagSceneryInfo.strLensmanAssistant = m_List1.GetItemText(nSceneryItem, 8 + m_nAdd);
  142. tagSceneryInfo.strBootDivision = m_List1.GetItemText(nSceneryItem, 9 + m_nAdd);
  143. tagSceneryInfo.strBootDivisionAssistant = m_List1.GetItemText(nSceneryItem, 10 + m_nAdd);
  144. tagOrderInfo.vtOrderScenery.push_back(tagSceneryInfo);
  145. // 查找所有下行;
  146. nSceneryItem++;
  147. if ( nSceneryItem < nItemCount )
  148. {
  149. while( m_List1.GetItemText(nSceneryItem, 0 + m_nAdd) == _T("") )
  150. {
  151. tagSceneryInfo.bSelected = FALSE;
  152. tagSceneryInfo.strScenery = m_List1.GetItemText(nSceneryItem, 4 + m_nAdd);
  153. tagSceneryInfo.strStatus = m_List1.GetItemText(nSceneryItem, 5 + m_nAdd);
  154. tagSceneryInfo.strTime = m_List1.GetItemText(nSceneryItem, 6 + m_nAdd);
  155. tagSceneryInfo.strLensman = m_List1.GetItemText(nSceneryItem, 7 + m_nAdd);
  156. tagSceneryInfo.strLensmanAssistant = m_List1.GetItemText(nSceneryItem, 8 + m_nAdd);
  157. tagSceneryInfo.strBootDivision = m_List1.GetItemText(nSceneryItem, 9 + m_nAdd);
  158. tagSceneryInfo.strBootDivisionAssistant = m_List1.GetItemText(nSceneryItem, 10 + m_nAdd);
  159. tagOrderInfo.vtOrderScenery.push_back(tagSceneryInfo);
  160. nSceneryItem++;
  161. if ( nSceneryItem >= nItemCount )
  162. break;
  163. }
  164. // 记录最后一个景点项索引;
  165. nEndofItem = nSceneryItem - 1;
  166. }
  167. // 查找所有上行;
  168. nSceneryItem = nSelectedItem - 1;
  169. if ( nSceneryItem >= 0)
  170. {
  171. while( m_List1.GetItemText(nSceneryItem, 0 + m_nAdd) == _T("") )
  172. {
  173. tagSceneryInfo.bSelected = FALSE;
  174. tagSceneryInfo.strScenery = m_List1.GetItemText(nSceneryItem, 4 + m_nAdd);
  175. tagSceneryInfo.strStatus = m_List1.GetItemText(nSceneryItem, 5 + m_nAdd);
  176. tagSceneryInfo.strTime = m_List1.GetItemText(nSceneryItem, 6 + m_nAdd);
  177. tagSceneryInfo.strLensman = m_List1.GetItemText(nSceneryItem, 7 + m_nAdd);
  178. tagSceneryInfo.strLensmanAssistant = m_List1.GetItemText(nSceneryItem, 8 + m_nAdd);
  179. tagSceneryInfo.strBootDivision = m_List1.GetItemText(nSceneryItem, 9 + m_nAdd);
  180. tagSceneryInfo.strBootDivisionAssistant = m_List1.GetItemText(nSceneryItem, 10 + m_nAdd);
  181. tagOrderInfo.vtOrderScenery.push_back(tagSceneryInfo);
  182. nSceneryItem--;
  183. if ( nSceneryItem < 0 )
  184. break;
  185. }
  186. }
  187. // 上行结束后,是头位置;
  188. if ( nSceneryItem >= 0 )
  189. {
  190. // 记录第一个景点项索引;
  191. nFirstItem = nSceneryItem;
  192. // 用头景点行初始化订单信息;
  193. if ( g_bAllBranch ) // 是否多店汇总;
  194. {
  195. tagOrderInfo.strBranchId = GetDomainFromBranch(m_List1.GetItemText(nSceneryItem, 0 ));
  196. }
  197. else
  198. {
  199. if ( g_branchname == _T(""))
  200. tagOrderInfo.strBranchId = g_domain;
  201. else
  202. tagOrderInfo.strBranchId = GetDomainFromBranch(g_branchname);
  203. }
  204. tagOrderInfo.strOrderNumber = m_List1.GetItemText(nSceneryItem, 0 + m_nAdd);
  205. tagOrderInfo.strName1 = m_List1.GetItemText(nSceneryItem, 1 + m_nAdd);
  206. tagOrderInfo.strName2 = m_List1.GetItemText(nSceneryItem, 2 + m_nAdd);
  207. tagOrderInfo.strImageNumber = m_List1.GetItemText(nSceneryItem, 3 + m_nAdd);
  208. tagOrderInfo.strClerk = m_List1.GetItemText(nSceneryItem, 11 + m_nAdd);
  209. // 如果用户权限不足,13和14显示的是"*"符号;
  210. #if 1
  211. tagOrderInfo.strPhone = m_List1.GetItemText(nSceneryItem, 14 + m_nAdd);
  212. tagOrderInfo.strTelPhone = m_List1.GetItemText(nSceneryItem, 15 + m_nAdd);
  213. #else
  214. if ( g_bAllBranch )
  215. {
  216. for (int i = 0; i < m_List1arrayBak.GetSize(); i++)
  217. {
  218. if ( tagOrderInfo.strOrderNumber == m_List1arrayBak.ElementAt(i).ElementAt(1) && tagOrderInfo.strBranchId == m_List1arrayBak.ElementAt(i).ElementAt(0) )
  219. {
  220. tagOrderInfo.strPhone = m_List1arrayBak.ElementAt(i).ElementAt(14 + m_nAdd);
  221. tagOrderInfo.strTelPhone = m_List1arrayBak.ElementAt(i).ElementAt(15 + m_nAdd);
  222. break;
  223. }
  224. }
  225. }
  226. else
  227. {
  228. for (int i = 0; i < m_List1arrayBak.GetSize(); i++)
  229. {
  230. if ( tagOrderInfo.strOrderNumber == m_List1arrayBak.ElementAt(i).ElementAt(0) )
  231. {
  232. tagOrderInfo.strPhone = m_List1arrayBak.ElementAt(i).ElementAt(14 + m_nAdd);
  233. tagOrderInfo.strTelPhone = m_List1arrayBak.ElementAt(i).ElementAt(15 + m_nAdd);
  234. break;
  235. }
  236. }
  237. }
  238. #endif
  239. // 同时push头景点;
  240. tagSceneryInfo.bSelected = FALSE;
  241. tagSceneryInfo.strScenery = m_List1.GetItemText(nSceneryItem, 4 + m_nAdd);
  242. tagSceneryInfo.strStatus = m_List1.GetItemText(nSceneryItem, 5 + m_nAdd);
  243. tagSceneryInfo.strTime = m_List1.GetItemText(nSceneryItem, 6 + m_nAdd);
  244. tagSceneryInfo.strLensman = m_List1.GetItemText(nSceneryItem, 7 + m_nAdd);
  245. tagSceneryInfo.strLensmanAssistant = m_List1.GetItemText(nSceneryItem, 8 + m_nAdd);
  246. tagSceneryInfo.strBootDivision = m_List1.GetItemText(nSceneryItem, 9 + m_nAdd);
  247. tagSceneryInfo.strBootDivisionAssistant = m_List1.GetItemText(nSceneryItem, 10 + m_nAdd);
  248. tagOrderInfo.vtOrderScenery.push_back(tagSceneryInfo);
  249. }
  250. }
  251. else
  252. {
  253. // 记录第一个景点项索引;
  254. nFirstItem = nSceneryItem;
  255. // 用头景点行初始化订单信息;
  256. if ( g_bAllBranch ) // 是否多店汇总;
  257. {
  258. tagOrderInfo.strBranchId = GetDomainFromBranch(m_List1.GetItemText(nSceneryItem, 0 ));
  259. }
  260. else
  261. {
  262. if ( g_branchname == _T(""))
  263. tagOrderInfo.strBranchId = g_domain;
  264. else
  265. tagOrderInfo.strBranchId = GetDomainFromBranch(g_branchname);
  266. }
  267. tagOrderInfo.strOrderNumber = m_List1.GetItemText(nSelectedItem, 0 + m_nAdd);
  268. tagOrderInfo.strName1 = m_List1.GetItemText(nSelectedItem, 1 + m_nAdd);
  269. tagOrderInfo.strName2 = m_List1.GetItemText(nSelectedItem, 2 + m_nAdd);
  270. tagOrderInfo.strImageNumber = m_List1.GetItemText(nSelectedItem, 3 + m_nAdd);
  271. tagOrderInfo.strClerk = m_List1.GetItemText(nSelectedItem, 11 + m_nAdd);
  272. tagOrderInfo.strPhone = m_List1.GetItemText(nSelectedItem, 14 + m_nAdd);
  273. tagOrderInfo.strTelPhone = m_List1.GetItemText(nSelectedItem, 15 + m_nAdd);
  274. // push头景点;
  275. STSceneryInfo tagSceneryInfo;
  276. tagSceneryInfo.bSelected = TRUE;
  277. tagSceneryInfo.strScenery = m_List1.GetItemText(nSelectedItem, 4 + m_nAdd);
  278. tagSceneryInfo.strStatus = m_List1.GetItemText(nSelectedItem, 5 + m_nAdd);
  279. tagSceneryInfo.strTime = m_List1.GetItemText(nSelectedItem, 6 + m_nAdd);
  280. tagSceneryInfo.strLensman = m_List1.GetItemText(nSelectedItem, 7 + m_nAdd);
  281. tagSceneryInfo.strLensmanAssistant = m_List1.GetItemText(nSelectedItem, 8 + m_nAdd);
  282. tagSceneryInfo.strBootDivision = m_List1.GetItemText(nSelectedItem, 9 + m_nAdd);
  283. tagSceneryInfo.strBootDivisionAssistant = m_List1.GetItemText(nSelectedItem, 10 + m_nAdd);
  284. tagOrderInfo.vtOrderScenery.push_back(tagSceneryInfo);
  285. // 读取下一行,看是否属于本订单的景点;
  286. nSceneryItem++;
  287. if ( nSceneryItem < nItemCount )
  288. {
  289. while( m_List1.GetItemText( nSceneryItem, 0 + m_nAdd ) == _T("") )
  290. {
  291. tagSceneryInfo.bSelected = FALSE;
  292. tagSceneryInfo.strScenery = m_List1.GetItemText(nSceneryItem, 4 + m_nAdd);
  293. tagSceneryInfo.strStatus = m_List1.GetItemText(nSceneryItem, 5 + m_nAdd);
  294. tagSceneryInfo.strTime = m_List1.GetItemText(nSceneryItem, 6 + m_nAdd);
  295. tagSceneryInfo.strLensman = m_List1.GetItemText(nSceneryItem, 7 + m_nAdd);
  296. tagSceneryInfo.strLensmanAssistant = m_List1.GetItemText(nSceneryItem, 8 + m_nAdd);
  297. tagSceneryInfo.strBootDivision = m_List1.GetItemText(nSceneryItem, 9 + m_nAdd);
  298. tagSceneryInfo.strBootDivisionAssistant = m_List1.GetItemText(nSceneryItem, 10 + m_nAdd);
  299. tagOrderInfo.vtOrderScenery.push_back(tagSceneryInfo);
  300. nSceneryItem++;
  301. if ( nSceneryItem >= nItemCount )
  302. break;
  303. }
  304. // 记录最后一个景点项索引;
  305. nEndofItem = nSceneryItem - 1;
  306. }
  307. }
  308. return nSelectedItem;
  309. }
  310. void TakeFrom::OnBUTimportphoto() // 导入原片按钮;
  311. {
  312. INT nFirstItem = 0;
  313. INT nEndofItem = 0;
  314. STOrederInfo tagOrderInfo;
  315. INT nSelectedItem = GetSelectedOrderInfo(tagOrderInfo, nFirstItem, nEndofItem);
  316. // 有多少拍照OK的景点;
  317. INT nOKSize = 0;
  318. vector<STSceneryInfo>::iterator it = NULL;
  319. for ( it = tagOrderInfo.vtOrderScenery.begin(); it != tagOrderInfo.vtOrderScenery.end(); it++ )
  320. {
  321. if ( it->strStatus == _T("OK") )
  322. nOKSize++;
  323. }
  324. CSetOrderInfo dlg;
  325. for ( it = tagOrderInfo.vtOrderScenery.begin(); it != tagOrderInfo.vtOrderScenery.end(); it++ )
  326. {
  327. // 当前选中的景点列;
  328. if ( it->bSelected == TRUE )
  329. {
  330. dlg.waiter1 = it->strLensman;
  331. dlg.waiter12 = it->strLensmanAssistant;
  332. dlg.waiter2 = it->strBootDivision;
  333. dlg.waiter22 = it->strBootDivisionAssistant;
  334. // 让对话窗口弹出时,显示当前景点的拍照状态;
  335. if(it->strStatus == _T("OK"))
  336. dlg.m_nStatus = 0;
  337. else if( it->strStatus == _T("拍照中") )
  338. dlg.m_nStatus = 1;
  339. else if( it->strStatus == _T("未拍") )
  340. dlg.m_nStatus = 2;
  341. break;
  342. }
  343. }
  344. if ( dlg.DoModal() == IDOK )
  345. {
  346. it->strLensman = dlg.waiter1;
  347. it->strLensmanAssistant = dlg.waiter12;
  348. it->strBootDivision = dlg.waiter2;
  349. it->strBootDivisionAssistant = dlg.waiter22;
  350. // m_nStatus:
  351. // 0:此景点拍照OK; 1:此景点拍照中; 2:此景点未拍照; 3:全部景点拍照OK;
  352. if ( dlg.m_nStatus == 0 )
  353. {// 所选景点设置OK,nOKSize加;
  354. if ( it->strStatus != _T("OK"))
  355. nOKSize++;
  356. it->strStatus = _T("OK");
  357. }
  358. else if ( dlg.m_nStatus == 1 )
  359. {// 所选景点设置拍照中; 若原本景点OK,nOKSize减;
  360. if ( it->strStatus == _T("OK"))
  361. nOKSize--;
  362. it->strStatus = _T("拍照中");
  363. }
  364. else if ( dlg.m_nStatus == 2 )
  365. {// 所选景点设置未拍照;若原本景点OK,nOKSize加;
  366. if ( it->strStatus == _T("OK"))
  367. nOKSize--;
  368. it->strStatus = _T("未拍");
  369. }
  370. else if ( dlg.m_nStatus == 3 )
  371. {// 全部景点设置OK;
  372. nOKSize = tagOrderInfo.vtOrderScenery.size();
  373. it->strStatus = _T("OK");
  374. }
  375. //////////////////////////////////////////////////////////////////////////
  376. // SQL语句;
  377. CString strSQL = _T("");
  378. CString strSQL2 = _T("");
  379. if ( nOKSize == 0 )
  380. {// 全部景点未拍照;
  381. //strSQL.Format(_T("update dindan set [status] = '未拍' where id = '%s'"), tagOrderInfo.strOrderNumber);
  382. strSQL.Format(_T("update dindan set [status] = case when status <> 'OK' then '未拍' else status end where id = '%s'"), tagOrderInfo.strOrderNumber);
  383. }
  384. else if ( nOKSize == tagOrderInfo.vtOrderScenery.size() )
  385. {// 全部景点都OK,设置所有dindanjd表的订单景点拍照状态OK;
  386. strSQL.Format(_T("update dindan set [status] = 'OK' where id = '%s'"), tagOrderInfo.strOrderNumber);
  387. strSQL2.Format(_T("***update dindanjd set [status] = 'OK' where id = '%s'"),tagOrderInfo.strOrderNumber);
  388. strSQL += strSQL2;
  389. //////////////////////////////////////////////////////////////////////////
  390. // 全部景点拍照OK时,判断是否需要生成短信;
  391. if ( atoi(g_cominfoarray.ElementAt(0).ElementAt(101)) )
  392. {
  393. CString strTimeStamp = _T("msgtimestamp");
  394. CString strSMSContent = CString(g_cominfoarray.ElementAt(0).ElementAt(105));
  395. // 获取用户手机号码;
  396. CString strPhone1 = tagOrderInfo.strPhone;
  397. CString strPhone2 = tagOrderInfo.strTelPhone;
  398. if ( strPhone1.Find(_T("***")) != -1 )
  399. {//若用户权限不足以获取手机号码,重新获取;
  400. CString strBranchName = GetBranchNamebyId(tagOrderInfo.strBranchId);
  401. if ( g_bAllBranch )
  402. {
  403. for (int i = 0; i < m_List1arrayBak.GetSize(); i++)
  404. {
  405. if (tagOrderInfo.strOrderNumber == m_List1arrayBak.ElementAt(i).ElementAt(1) && strBranchName == m_List1arrayBak.ElementAt(i).ElementAt(0))
  406. {
  407. strPhone1 = m_List1arrayBak.ElementAt(i).ElementAt(14 + m_nAdd);
  408. strPhone2 = m_List1arrayBak.ElementAt(i).ElementAt(15 + m_nAdd);
  409. break;
  410. }
  411. }
  412. }
  413. else
  414. {
  415. for (int i = 0; i < m_List1arrayBak.GetSize(); i++)
  416. {
  417. if (tagOrderInfo.strOrderNumber == m_List1arrayBak.ElementAt(i).ElementAt(0))
  418. {
  419. strPhone1 = m_List1arrayBak.ElementAt(i).ElementAt(14 + m_nAdd);
  420. strPhone2 = m_List1arrayBak.ElementAt(i).ElementAt(15 + m_nAdd);
  421. break;
  422. }
  423. }
  424. }
  425. }
  426. // 生成短信内容;
  427. CString strtemp = _T("");
  428. #ifdef CHILD_VERSION
  429. if ( !tagOrderInfo.strName1.IsEmpty() )
  430. strtemp = tagOrderInfo.strName1 + _T(",");
  431. strtemp += tagOrderInfo.strName2;
  432. strtemp.TrimRight(_T(","));
  433. if( !strtemp.IsEmpty() && CheckPhoneType(strPhone1) != -1 && CheckBadWords(strtemp,0) )
  434. {
  435. strtemp += strSMSContent;
  436. strtemp.Replace(_T("xxx小朋友"), _T(""));
  437. int nCount = GetLengthEx(strtemp)/MSG_LENGTH;
  438. if( GetLengthEx(strtemp)%MSG_LENGTH )
  439. nCount++;
  440. strSQL2.Format(INSERT_SENDREG_MC, _T("11"), strPhone1, strtemp, strTimeStamp, nCount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  441. strSQL += _T("***") + strSQL2;
  442. }
  443. #else
  444. if ( strSMSContent.Find(_T("xxx先生/女士")) != -1 )
  445. {
  446. int nCount = 0;
  447. // 男士短信;
  448. if ( !tagOrderInfo.strName1.IsEmpty() && CheckPhoneType(strPhone1) != -1 && CheckBadWords(tagOrderInfo.strName1, 0) )
  449. {
  450. strtemp = strSMSContent;
  451. strtemp.Replace(_T("xxx先生/女士"), tagOrderInfo.strName1 + _T("先生"));
  452. nCount = GetLengthEx(strtemp) / MSG_LENGTH;
  453. if ( GetLengthEx(strtemp) % MSG_LENGTH )
  454. nCount++;
  455. strSQL2.Format(INSERT_SENDREG_MC, _T("11"), strPhone1, strtemp, strTimeStamp, nCount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  456. strSQL += _T("***") + strSQL2;
  457. }
  458. // 女士短信;
  459. if ( !tagOrderInfo.strName2.IsEmpty() && CheckPhoneType(strPhone2) != -1 && CheckBadWords(tagOrderInfo.strName2, 0) )
  460. {
  461. strtemp = strSMSContent;
  462. strtemp.Replace(_T("xxx先生/女士"), tagOrderInfo.strName1 + _T("先生"));
  463. nCount = GetLengthEx(strtemp) / MSG_LENGTH;
  464. if ( GetLengthEx(strtemp) % MSG_LENGTH )
  465. nCount++;
  466. strSQL2.Format(INSERT_SENDREG_MC, _T("11"), strPhone1, strtemp, _T("msgtimexxstamp"), nCount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  467. strSQL += _T("***") + strSQL2;
  468. }
  469. }
  470. #endif
  471. }
  472. }
  473. else
  474. {// 部分景点拍照;拍照中;
  475. //strSQL.Format(_T("update dindan set [status] = '拍照中' where id = '%s'"), tagOrderInfo.strOrderNumber);
  476. strSQL.Format(_T("update dindan set [status] = case when status <> 'OK' then '拍照中' else status end where id = '%s'"), tagOrderInfo.strOrderNumber);
  477. }
  478. // 最多4个景点,4组摄影师+化妆师;
  479. if ( nSelectedItem == nFirstItem )
  480. {
  481. strSQL2.Format(_T("***update dindan set waiter1 = '%s', waiter2 = '%s' where id = '%s'"),
  482. it->strLensman,it->strBootDivision,tagOrderInfo.strOrderNumber);
  483. }
  484. else if ( nSelectedItem == nFirstItem + 1)
  485. {
  486. strSQL2.Format(_T("***update dindan set waiter12 = '%s', waiter22 = '%s' where id = '%s'"),
  487. it->strLensman,it->strBootDivision,tagOrderInfo.strOrderNumber);
  488. }
  489. else if ( nSelectedItem == nFirstItem + 2)
  490. {
  491. strSQL2.Format(_T("***update dindan set waiter13 = '%s', waiter23 = '%s' where id = '%s'"),
  492. it->strLensman,it->strBootDivision,tagOrderInfo.strOrderNumber);
  493. }
  494. else if ( nSelectedItem == nFirstItem + 3)
  495. {
  496. strSQL2.Format(_T("***update dindan set waiter14 = '%s', waiter24 = '%s' where id = '%s'"),
  497. it->strLensman,it->strBootDivision,tagOrderInfo.strOrderNumber);
  498. }
  499. strSQL += strSQL2;
  500. strSQL2.Format(_T("***update dindanjd set [date]= '%s', [status] = '%s', [waiter1] = '%s', [waiter12] = '%s', [waiter2] = '%s',[waiter22] ='%s' where id = '%s' and [name] = '%s' "),
  501. g_date, it->strStatus, it->strLensman, it->strLensmanAssistant, it->strBootDivision, it->strBootDivisionAssistant, tagOrderInfo.strOrderNumber, it->strScenery);
  502. strSQL += strSQL2;
  503. strSQL2.Format(_T("***gentakecontent:"),tagOrderInfo.strOrderNumber);//拍照OK时记录客人预定内容
  504. strSQL += strSQL2;
  505. //////////////////////////////////////////////////////////////////////////
  506. // 构建发送给服务器的包;
  507. g_sendhead.bsql = TRUE;
  508. if ( g_bAllBranch )
  509. {
  510. // 多店汇总;
  511. g_branchip = GetIP(tagOrderInfo.strBranchId);
  512. g_pMainWnd->OnDisconnect();
  513. g_branchname = tagOrderInfo.strBranchId;
  514. g_bBranchModify = TRUE;
  515. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  516. g_pMainWnd->OnDisconnect();
  517. g_bBranchModify = FALSE;
  518. g_branchip = g_branchname = _T("");
  519. }
  520. else
  521. {
  522. g_pMainWnd->ProcessChatMessageRequest2(strSQL);
  523. }
  524. //////////////////////////////////////////////////////////////////////////
  525. // 接收服务器返回的数据;
  526. if (g_bSendOK == 0)
  527. {
  528. OutputDebugString(_T("\n服务器返回数据失败!\n"));
  529. return;
  530. }
  531. if (g_bAllBranch == 0)
  532. {// 连接本店或分店时;
  533. GetData();
  534. }
  535. else
  536. {// 多店汇总时;
  537. BOOL bFind = 0;
  538. for (int i = 0; i < m_List1array.GetSize(); i++)
  539. {
  540. if (bFind && m_List1array.ElementAt(i).ElementAt(1) != _T(""))break;
  541. if (tagOrderInfo.strOrderNumber == m_List1array.ElementAt(i).ElementAt(1) && tagOrderInfo.strBranchId == m_List1array.ElementAt(i).ElementAt(0))
  542. {
  543. bFind = 1;
  544. }
  545. if (bFind && it->strScenery == m_List1array.ElementAt(i).ElementAt(4))
  546. {
  547. m_List1array.ElementAt(i).SetAt(7 + m_nAdd, it->strLensman);
  548. m_List1array.ElementAt(i).SetAt(8 + m_nAdd, it->strLensmanAssistant);
  549. m_List1array.ElementAt(i).SetAt(9 + m_nAdd, it->strBootDivision);
  550. m_List1array.ElementAt(i).SetAt(10 + m_nAdd, it->strBootDivisionAssistant);
  551. m_List1array.ElementAt(i).SetAt(5 + m_nAdd, it->strStatus);
  552. m_List1array.ElementAt(i).SetAt(6 + m_nAdd, g_date);
  553. //m_List1array.ElementAt(i).SetAt(3 + m_nAdd, sbeginno);
  554. FillGrid();
  555. break;
  556. }
  557. }
  558. }
  559. }
  560. //////////////////////////////////////////////////////////////////////////
  561. INT nImgNum = atoi(tagOrderInfo.strImageNumber);
  562. if ( nImgNum <= 0)
  563. nImgNum = 1;
  564. else
  565. ++nImgNum;
  566. ImgImportInterface *pImport = NULL;
  567. g_pIMSProcess->QueryInterface(IID_ImgImportInterface, (void**)&pImport);
  568. if ( pImport )
  569. {
  570. pImport->ImportOriginalImg(
  571. TRUE, // 文件夹形式打开源或多选文件形式;
  572. TRUE, // 相片是否需要重命名;
  573. nImgNum, // 相片数字编号;
  574. tagOrderInfo.strBranchId, // 分店域名;
  575. tagOrderInfo.strOrderNumber, // 订单号;
  576. tagOrderInfo.strName1 + _T(",") + tagOrderInfo.strName2, // 顾客信息,可任意组合;
  577. TRUE, // 导入时,是否生成景点名文件夹;
  578. it->strScenery, // 导入时,景点名;
  579. _T("*.jpg|*.jpeg"), // 导入时,主扩展名相片;
  580. INVALID_COPY_PIX, // 导入时,主扩展名相片的压缩像素;
  581. _T("*.nef|*.cr2|*.raw"), // 导入时,附加的扩展名相片;
  582. TRUE, // 导入时,是否生成缩略图;
  583. SET_PIX(100,100), // 导入时,生成的缩略图像素大小;
  584. FALSE // 导入时,文件存在时是否覆盖;
  585. );
  586. g_pIMSProcess->Release();
  587. }
  588. // 结束;
  589. }
  590. void BeautifySkinFrom::OnBUTexportphoto() // 导出原片;
  591. {
  592. // 判断登陆用户是否有导出原片的权限;
  593. if ( !IsHasRights2new(8) )
  594. {
  595. AfxMessageBox(_T("您无权限导出原片!"),MB_ICONINFORMATION);
  596. return;
  597. }
  598. // 获取列表信息:域名、订单号、景点名、顾客信息;
  599. POSITION pos = m_List1.GetFirstSelectedItemPosition();
  600. if ( pos == NULL )
  601. {
  602. AfxMessageBox(_T("请选中您要导出原片的订单!"), MB_ICONINFORMATION);
  603. return;
  604. }
  605. INT nItemCount = m_List1.GetItemCount();
  606. INT nSelectedItem = m_List1.GetNextSelectedItem(pos);
  607. CString strBranchId = _T("");
  608. CString strOrderNum = _T("");
  609. // 初修列表不支持景点名,需要从其他地方获取;
  610. CString strScenery = _T("");
  611. CString strCustomerInfo = _T("");
  612. // 获取域名;
  613. if ( g_bAllBranch )
  614. {// 多店汇总时;
  615. strBranchId = GetDomainFromBranch( m_List1.GetItemText(nSelectedItem, 0) );
  616. }
  617. else
  618. {
  619. if ( g_branchname.IsEmpty() )
  620. {// 连接本店时;
  621. strBranchId = g_domain;
  622. }
  623. else
  624. {// 连接分店时;
  625. strBranchId = GetDomainFromBranch( g_branchname );
  626. }
  627. }
  628. // 获取订单号;
  629. strOrderNum = m_List1.GetItemText(nSelectedItem, 0 + m_nAdd);
  630. // 获取顾客信息;
  631. strCustomerInfo = m_List1.GetItemText(nSelectedItem, 1 + m_nAdd) + _T(",") + m_List1.GetItemText(nSelectedItem, 2 + m_nAdd);
  632. // 获取景点名,需要读取dindanjd表获取,目前只支持儿童成长套系订单;
  633. IsGrowthTx IsGrowthtxdlg;
  634. IsGrowthtxdlg.m_mode = 1;
  635. IsGrowthtxdlg.m_strOrderNumber = strOrderNum;
  636. IsGrowthtxdlg.DoModal();
  637. if( IsGrowthtxdlg.m_bReturnOK == 0 || (IsGrowthtxdlg.m_bGrowthTx && IsGrowthtxdlg.m_seltxname.IsEmpty()) )
  638. {
  639. return;
  640. }
  641. if ( IsGrowthtxdlg.m_bGrowthTx )
  642. {
  643. // 读取dindanjd表里的成长套系名,并返回选中的成长套系名;
  644. strScenery = IsGrowthtxdlg.m_seltxname;
  645. if ( strScenery == _T("全部") )
  646. {
  647. strScenery.Empty();
  648. }
  649. }
  650. // 导出原片时,是否压缩导出;
  651. DWORD dwExportPix = INVALID_COPY_PIX; // 通过其他对话框,选择导出时压缩的像素;
  652. /////////////////////////////////////////////////////////////////////////////////////////////////
  653. // 获取完信息,开始导出原片;
  654. ImgExportInterface *pExport = NULL;
  655. g_pIMSProcess->QueryInterface(IID_ImgExportInterface, (void**)&pExport);
  656. if ( pExport )
  657. {
  658. pExport->ExportOriginalImg(
  659. TRUE,
  660. strBranchId,
  661. strOrderNum,
  662. strCustomerInfo,
  663. !strScenery.IsEmpty(),
  664. strScenery,
  665. _T("*.jpg|*.jpeg"),
  666. dwExportPix,
  667. _T("*.nef|*.cr2|*.raw|*.ra2"),
  668. FALSE,
  669. FALSE
  670. );
  671. }
  672. g_pIMSProcess->Release();
  673. // 结束;
  674. }