outsourcingDlg.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. // outsourcingDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "ylgl.h"
  5. #include "outsourcingDlg.h"
  6. #include "ShowMsg2.h"
  7. #include "SelProvider.h"
  8. #ifdef _DEBUG
  9. #define new DEBUG_NEW
  10. #undef THIS_FILE
  11. static char THIS_FILE[] = __FILE__;
  12. #endif
  13. /////////////////////////////////////////////////////////////////////////////
  14. // outsourcingDlg
  15. outsourcingDlg::outsourcingDlg(CWnd* pParent /*=NULL*/)
  16. : CDialog(outsourcingDlg::IDD)
  17. {
  18. //{{AFX_DATA_INIT(outsourcingDlg)IDC_COMBOid
  19. m_name1 = _T("");
  20. m_name2 = _T("");
  21. m_id = _T("");
  22. m_money1 = _T("");
  23. m_money2 = _T("");
  24. m_money3 = _T("");
  25. m_bGrowthTX = 0;
  26. //}}AFX_DATA_INIT
  27. }
  28. void outsourcingDlg::DoDataExchange(CDataExchange* pDX)
  29. {
  30. CDialog::DoDataExchange(pDX);
  31. //{{AFX_DATA_MAP(outsourcingDlg)
  32. DDX_Control(pDX, IDC_LIST1, m_List1);
  33. DDX_Text(pDX, IDC_EDITname1, m_name1);
  34. DDX_Text(pDX, IDC_EDITname2, m_name2);
  35. DDX_Text(pDX, IDC_EDITid2, m_id);
  36. DDX_Text(pDX, IDC_EDITmoney1, m_money1);
  37. DDX_Text(pDX, IDC_EDITmoney2, m_money2);
  38. DDX_Text(pDX, IDC_EDITmoney3, m_money3);
  39. //}}AFX_DATA_MAP
  40. }
  41. BEGIN_MESSAGE_MAP(outsourcingDlg, CDialog)
  42. //{{AFX_MSG_MAP(outsourcingDlg)
  43. ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
  44. ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
  45. ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
  46. ON_WM_TIMER()
  47. ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
  48. ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
  49. ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
  50. ON_WM_DESTROY()
  51. //}}AFX_MSG_MAP
  52. END_MESSAGE_MAP()
  53. BOOL outsourcingDlg::PreTranslateMessage(MSG* pMsg)
  54. {
  55. if (0)//pMsg->message==WM_LBUTTONDBLCLK)
  56. {
  57. {//list1
  58. CPoint pt;
  59. CRect rc, rc2;
  60. ::GetCursorPos(&pt);
  61. m_List1.GetWindowRect(rc2);
  62. if (rc2.PtInRect(pt)) return 1;
  63. }
  64. }
  65. return CDialog::PreTranslateMessage(pMsg);
  66. }
  67. void outsourcingDlg::OnBUTclose()
  68. {
  69. CDialog::OnCancel();
  70. }
  71. void outsourcingDlg::GetData()
  72. {
  73. CArray<CStringArray, CStringArray>List1array;
  74. if (g_bAllBranch == 0)
  75. {
  76. #ifdef CHILD_VERSION
  77. CString filter = "id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  78. #else
  79. CString filter = "id='" + m_id + "' and kind<>'2' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  80. #endif
  81. g_sendhead.code[0] = 56; // dindansp表;
  82. g_sendhead.code[1] = 11; // dindan表;
  83. g_sendhead.code[2] = 9; // gongyingshang表;供应商信息
  84. g_sendhead.code[3] = 8; // shangpin表;
  85. g_sendhead.tabcount = 4;
  86. g_sendhead.bsql = 0;
  87. g_pMainWnd->ProcessChatMessageRequest2(filter);
  88. if (g_bSendOK == 0)return;
  89. DataToArray(&m_sparray, &List1array, &g_List1array, &m_List2array);
  90. }
  91. else
  92. {
  93. g_pMainWnd->OnDisconnect();
  94. g_branchip = GetIP(m_branch);
  95. g_pMainWnd->OnDisconnect();
  96. g_branchname = m_branch;
  97. g_bBranchModify = 1;
  98. #ifdef CHILD_VERSION
  99. CString filter = "id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  100. #else
  101. CString filter = "id='" + m_id + "' and kind<>'2' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
  102. #endif
  103. g_sendhead.code[0] = 56;
  104. g_sendhead.code[1] = 11;
  105. g_sendhead.code[2] = 9;//供应商信息
  106. g_sendhead.code[3] = 8;
  107. g_sendhead.tabcount = 4;
  108. g_sendhead.bsql = 0;
  109. g_pMainWnd->ProcessChatMessageRequest2(filter);
  110. if (g_bSendOK == 0)return;
  111. DataToArray(&m_sparray, &List1array, &g_List1array, &m_List2array);
  112. }
  113. if ("成长套系" == List1array.ElementAt(0).ElementAt(52))
  114. m_bGrowthTX = 1;
  115. m_phone1 = List1array.ElementAt(0).ElementAt(61);
  116. m_phone2 = List1array.ElementAt(0).ElementAt(62);
  117. oldstatus = List1array.ElementAt(0).ElementAt(33);
  118. m_List1.DeleteAllItems();
  119. int listpos[3] = { 0 };
  120. CComboBoxListCtrl *pList[1] = { &m_List1 };
  121. int pos = 0;
  122. oldstatus2 = "OK";
  123. for (int i = 0; i < m_sparray.GetSize(); i++)
  124. {
  125. pList[pos]->InsertItem(listpos[pos], m_sparray.ElementAt(i).ElementAt(0));
  126. pList[pos]->SetItemText(listpos[pos], 1, m_sparray.ElementAt(i).ElementAt(1));
  127. #ifdef LKAY_VERSION
  128. pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt(i).ElementAt(29));
  129. pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt(i).ElementAt(30));
  130. #else
  131. pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt(i).ElementAt(18));
  132. pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt(i).ElementAt(19));
  133. #endif
  134. pList[pos]->SetItemText(listpos[pos], 4, m_sparray.ElementAt(i).ElementAt(2));
  135. pList[pos]->SetItemText(listpos[pos], 5, m_sparray.ElementAt(i).ElementAt(9) + "/" + m_sparray.ElementAt(i).ElementAt(10));
  136. pList[pos]->SetItemText(listpos[pos], 6, m_sparray.ElementAt(i).ElementAt(3));
  137. pList[pos]->SetItemText(listpos[pos], 7, m_sparray.ElementAt(i).ElementAt(11) + "/" + m_sparray.ElementAt(i).ElementAt(12));
  138. pList[pos]->SetItemText(listpos[pos], 8, m_sparray.ElementAt(i).ElementAt(4));
  139. pList[pos]->SetItemText(listpos[pos], 9, m_sparray.ElementAt(i).ElementAt(13) + "/" + m_sparray.ElementAt(i).ElementAt(14));
  140. #ifdef LKAY_VERSION
  141. pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt(i).ElementAt(23));
  142. pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt(i).ElementAt(25) + "/" + m_sparray.ElementAt(i).ElementAt(26));
  143. pList[pos]->SetItemText(listpos[pos], 12, m_sparray.ElementAt(i).ElementAt(24));
  144. pList[pos]->SetItemText(listpos[pos], 13, m_sparray.ElementAt (i).ElementAt (27)+"/"+m_sparray.ElementAt (i).ElementAt (28));
  145. pList[pos]->SetItemText(listpos[pos], 14, m_sparray.ElementAt (i).ElementAt (5));
  146. pList[pos]->SetItemText(listpos[pos], 15, m_sparray.ElementAt (i).ElementAt (15)+"/"+m_sparray.ElementAt (i).ElementAt (16));
  147. #else
  148. pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt(i).ElementAt(5));
  149. pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt(i).ElementAt(15) + "/" + m_sparray.ElementAt(i).ElementAt(16));
  150. #endif
  151. if (m_sparray.ElementAt(i).ElementAt(4) != "OK")
  152. oldstatus2 = "未完成";
  153. listpos[pos]++;
  154. }
  155. if (List1array.GetSize())
  156. {
  157. CString m_taoxijiage = List1array.ElementAt(0).ElementAt(8);
  158. CString m_payed4 = List1array.ElementAt(0).ElementAt(19);
  159. CString m_payed5 = List1array.ElementAt(0).ElementAt(20);
  160. m_money1 = List1array.ElementAt(0).ElementAt(1);
  161. m_money2.Format("%f", atof(m_payed5) + atof(m_money1));
  162. m_money1.Format("%f", atof(m_taoxijiage) + atof(m_payed4));
  163. m_money3.Format("%f", atof(m_money1) - atof(m_money2));
  164. ConvertToPrice(m_money1);
  165. ConvertToPrice(m_money2);
  166. ConvertToPrice(m_money3);
  167. UpdateData(false);
  168. }
  169. SetTimer(1, 500, NULL);
  170. }
  171. extern BOOL CALLBACK EnumChildProc2(HWND hwnd, LPARAM lParam);
  172. BOOL outsourcingDlg::OnInitDialog()
  173. {
  174. CDialog::OnInitDialog();
  175. #ifdef CHILD_VERSION
  176. GetDlgItem(IDC_STATIC1)->SetWindowText("家长姓名:");
  177. GetDlgItem(IDC_STATIC2)->SetWindowText("宝宝姓名:");
  178. #endif
  179. CRect rc2;
  180. GetWindowRect(rc2);
  181. ::MoveWindow(m_hWnd, 0, g_rc.top, g_rc.left + g_rc.Width(), g_rc.Height(), TRUE);
  182. g_WidthScale2 = (float)(g_rc.left + g_rc.Width()) / (float)rc2.Width(); // new/Old
  183. g_HeightScale2 = (float)g_rc.Height() / (float)rc2.Height();
  184. EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc2, 0);
  185. m_List1.m_sparray = &m_sparray;
  186. m_List1.InitStyle();
  187. #ifdef LKAY_VERSION
  188. int idarray[] = { IDC_BUTTON3, IDC_BUTTON1, IDC_BUTTON5, IDC_BUTTON4, IDC_BUTTON2, IDOK, IDC_BUTclose };
  189. int idcount = 7;
  190. GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_SHOW);
  191. GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_SHOW);
  192. #else
  193. int idarray[] = { IDC_BUTTON3, IDC_BUTTON1, IDC_BUTTON2, IDOK, IDC_BUTclose };
  194. int idcount = 5;
  195. #endif
  196. int btnwid;
  197. CRect prerc;
  198. for (int a = idcount - 2; a >= 0; a--)
  199. {
  200. GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
  201. ScreenToClient(prerc);
  202. GetDlgItem(idarray[a])->GetWindowRect(rc2);
  203. ScreenToClient(rc2);
  204. btnwid = rc2.Width();
  205. rc2.right = prerc.left;
  206. rc2.left = rc2.right - btnwid;
  207. GetDlgItem(idarray[a])->MoveWindow(rc2);
  208. }
  209. #ifdef LKAY_VERSION
  210. m_List1.InsertColumn(0, _T("商品名称"), LVCFMT_LEFT, 160);
  211. m_List1.InsertColumn(1, _T("数量"), LVCFMT_LEFT, 50);
  212. // m_List1.InsertColumn(2,_T("加急"),LVCFMT_LEFT,50);
  213. // m_List1.InsertColumn(3,_T("取件日期"),LVCFMT_LEFT,100);
  214. m_List1.InsertColumn(2,_T("P数"),LVCFMT_LEFT,50);
  215. m_List1.InsertColumn(3,_T("张数"),LVCFMT_LEFT,100);
  216. m_List1.InsertColumn(4,_T("发出"),LVCFMT_LEFT,100);
  217. m_List1.InsertColumn(5,_T("发出日期"),LVCFMT_LEFT,140);
  218. m_List1.InsertColumn(6,_T("返工"),LVCFMT_LEFT,50);
  219. m_List1.InsertColumn(7,_T("返工日期"),LVCFMT_LEFT,140);
  220. m_List1.InsertColumn(8,_T("完成"),LVCFMT_LEFT,60);
  221. m_List1.InsertColumn(9,_T("完成日期"),LVCFMT_LEFT,140);
  222. m_List1.InsertColumn(10,_T("组件"),LVCFMT_LEFT,60);
  223. m_List1.InsertColumn(11,_T("组件日期"),LVCFMT_LEFT,140);
  224. m_List1.InsertColumn(12,_T("转走"),LVCFMT_LEFT,60);
  225. m_List1.InsertColumn(13,_T("转走日期"),LVCFMT_LEFT,140);
  226. m_List1.InsertColumn(14,_T("取走"),LVCFMT_LEFT,50);
  227. m_List1.InsertColumn(15,_T("取走日期"),LVCFMT_LEFT,140);
  228. #else
  229. m_List1.InsertColumn(0, _T("商品名称"), LVCFMT_LEFT, 160);
  230. m_List1.InsertColumn(1, _T("数量"), LVCFMT_LEFT, 50);
  231. m_List1.InsertColumn(2, _T("加急"), LVCFMT_LEFT, 50);
  232. m_List1.InsertColumn(3, _T("取件日期"), LVCFMT_LEFT, 100);
  233. m_List1.InsertColumn(4, _T("发出"), LVCFMT_LEFT, 100);
  234. m_List1.InsertColumn(5, _T("发出日期"), LVCFMT_LEFT, 140);
  235. m_List1.InsertColumn(6, _T("返工"), LVCFMT_LEFT, 50);
  236. m_List1.InsertColumn(7, _T("返工日期"), LVCFMT_LEFT, 140);
  237. m_List1.InsertColumn(8, _T("完成"), LVCFMT_LEFT, 60);
  238. m_List1.InsertColumn(9, _T("完成日期"), LVCFMT_LEFT, 140);
  239. m_List1.InsertColumn(10, _T("取走"), LVCFMT_LEFT, 50);
  240. m_List1.InsertColumn(11, _T("取走日期"), LVCFMT_LEFT, 140);
  241. #endif
  242. GetData();
  243. GetDlgItem(IDOK)->EnableWindow(IsHasRights2new(13));
  244. return TRUE;
  245. }
  246. void outsourcingDlg::OnOK() // 保存按钮;
  247. {
  248. if (IsHasRights2new(13) == 0)return;
  249. CString sql, str, m_status3, m_status4;
  250. m_status3 = "OK";
  251. m_status4 = "OK";
  252. for (int i = 0; i < m_List1.GetItemCount(); i++)
  253. {
  254. m_sparray.ElementAt(i).SetAt(2, m_List1.GetItemText(i, 4)); // 是否发出;
  255. m_sparray.ElementAt(i).SetAt(3, m_List1.GetItemText(i, 6)); // 是否返工;
  256. m_sparray.ElementAt(i).SetAt(4, m_List1.GetItemText(i, 8)); // 是否完成;
  257. #ifdef LKAY_VERSION
  258. m_sparray.ElementAt(i).SetAt(5, m_List1.GetItemText(i, 14));
  259. #else
  260. m_sparray.ElementAt(i).SetAt(5, m_List1.GetItemText(i, 10)); // 是否取走;
  261. #endif
  262. str = m_List1.GetItemText(i, 5); // 发出日期;
  263. m_sparray.ElementAt(i).SetAt(9, str.Left(str.Find('/')));
  264. m_sparray.ElementAt(i).SetAt(10, str.Right(str.GetLength() - str.Find('/') - 1));
  265. str = m_List1.GetItemText(i, 7); // 返工日期;
  266. m_sparray.ElementAt(i).SetAt(11, str.Left(str.Find('/')));
  267. m_sparray.ElementAt(i).SetAt(12, str.Right(str.GetLength() - str.Find('/') - 1));
  268. str = m_List1.GetItemText(i, 9); // 完成日期;
  269. m_sparray.ElementAt(i).SetAt(13, str.Left(str.Find('/')));
  270. m_sparray.ElementAt(i).SetAt(14, str.Right(str.GetLength() - str.Find('/') - 1));
  271. #ifdef LKAY_VERSION
  272. m_sparray.ElementAt(i).SetAt(23, m_List1.GetItemText(i, 10));
  273. m_sparray.ElementAt(i).SetAt(24, m_List1.GetItemText(i, 12));
  274. str=m_List1.GetItemText (i, 11);
  275. m_sparray.ElementAt (i).SetAt (25, str.Left (str.Find ('/')) );
  276. m_sparray.ElementAt (i).SetAt (26, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  277. str=m_List1.GetItemText (i, 13);
  278. m_sparray.ElementAt (i).SetAt (27, str.Left (str.Find ('/')) );
  279. m_sparray.ElementAt (i).SetAt (28, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  280. str=m_List1.GetItemText (i, 15);
  281. m_sparray.ElementAt (i).SetAt (15, str.Left (str.Find ('/')) );
  282. m_sparray.ElementAt (i).SetAt (16, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
  283. if(m_List1.GetItemText (i, 14)!="OK")
  284. m_status3="未取";
  285. if(m_List1.GetItemText (i, 8)!="OK")
  286. m_status4="未完成";
  287. #else
  288. str = m_List1.GetItemText(i, 11); // 取走日期;
  289. m_sparray.ElementAt(i).SetAt(15, str.Left(str.Find('/')));
  290. m_sparray.ElementAt(i).SetAt(16, str.Right(str.GetLength() - str.Find('/') - 1));
  291. if (m_List1.GetItemText(i, 10) != "OK")
  292. m_status3 = "未取";
  293. if (m_List1.GetItemText(i, 8) != "OK")
  294. m_status4 = "未完成";
  295. #endif
  296. }
  297. if (m_status3 == "OK" && m_bGrowthTX == 0)
  298. {
  299. if (AfxMessageBox("全部取件后此单将存入历史数据库并不可修改, 确认吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
  300. }
  301. if (atof(m_money3) > 0)
  302. if (AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
  303. if (atof(m_money3) < 0)
  304. if (AfxMessageBox("警告:此客人账目不清, 请向财务核对, 继续吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
  305. if (m_sparray.GetSize() == 0)
  306. {
  307. return;
  308. }
  309. if (1)//m_status3=="OK" && m_bGrowthTX==0)
  310. {//自动生成出库记录
  311. int size = m_sparray.GetSize();
  312. m_sparray.SetSize(size * 2);
  313. for (int i = 0; i < m_List1.GetItemCount(); i++)
  314. {
  315. m_sparray.ElementAt(size + i).RemoveAll();
  316. m_sparray.ElementAt(size + i).Add(m_id);
  317. m_sparray.ElementAt(size + i).Add(GetLB(m_List1.GetItemText(i, 0)));
  318. m_sparray.ElementAt(size + i).Add(m_List1.GetItemText(i, 0));
  319. m_sparray.ElementAt(size + i).Add(m_List1.GetItemText(i, 1));
  320. #ifdef LKAY_VERSION
  321. if (m_List1.GetItemText(i, 8) == "OK" || m_List1.GetItemText(i, 14) == "OK")
  322. m_sparray.ElementAt(size + i).Add("1");
  323. else
  324. m_sparray.ElementAt (size+i).Add ("0");
  325. #else
  326. if (m_List1.GetItemText(i, 8) == "OK" || m_List1.GetItemText(i, 10) == "OK")
  327. m_sparray.ElementAt(size + i).Add("1");
  328. else
  329. m_sparray.ElementAt(size + i).Add("0");
  330. #endif
  331. }
  332. }
  333. CMemFile memfile;
  334. CArchive ar(&memfile, CArchive::store);
  335. for (int ii = 0; ii < m_sparray.GetSize(); ii++)
  336. {
  337. m_sparray.ElementAt(ii).Serialize(ar);
  338. }
  339. ar.Close();
  340. int length = memfile.GetLength();
  341. BYTE *pData = memfile.Detach();
  342. int size = m_sparray.GetSize();
  343. BYTE *pData2 = new BYTE[length + sizeof(int)];
  344. memcpy(pData2, pData, length);
  345. memcpy(pData2 + length, &size, sizeof(int));
  346. delete[]pData;
  347. length += sizeof(int);
  348. g_nSendCode = 9;
  349. g_pMainWnd->ProcessChatMessageRequest2(pData2, length);
  350. g_nSendCode = 0;
  351. delete[]pData2;
  352. if (g_bSendOK == 0)return;
  353. sql = "";
  354. if (m_status3 == "OK" && m_bGrowthTX == 0)
  355. {
  356. sql = "update dindan set [status3]='" + m_status3 + "',[time5]='" + g_date + "' where id='" + m_id + "'";
  357. #if JEFF_TEST_ON
  358. // 2015-05-30 若取件状态OK,写日志;
  359. if ( m_status3 == _T("OK") )
  360. {
  361. CString strLog;
  362. strLog.Format(_T(" 订单:%s 在预约修改中被设置为取件OK"),m_id);
  363. WriteLog(strLog);
  364. }
  365. #endif
  366. ////////////////////////
  367. CString sql2;
  368. BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(104)); // 104==msgcheck14
  369. CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(108);
  370. if (oldstatus == "OK")msgcheck = 0;
  371. #ifdef CHILD_VERSION
  372. if (msgcheck)
  373. {
  374. CString m_content3 = msgcontent;
  375. CString str, timestamp;
  376. timestamp = "msgtimestamp";
  377. {
  378. CString name;
  379. if (!m_name1.IsEmpty())
  380. name = m_name1 + ",";
  381. name += m_name2;
  382. name.TrimRight(",");
  383. if (name.IsEmpty() == 0 && CheckPhoneType(m_phone1) != -1 && CheckBadWords(name, 0))
  384. {
  385. str = name + m_content3;
  386. str.Replace("xxx小朋友", "");
  387. int count = GetLengthEx(str) / MSG_LENGTH;
  388. if (GetLengthEx(str) % MSG_LENGTH)
  389. count++;
  390. CString scount;
  391. scount.Format("%d", count);
  392. #if JEFF_TEST_ON
  393. sql2.Format(INSERT_SENDREG, _T("14"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
  394. sql += _T("***") + sql2;
  395. #else
  396. sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone1 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  397. sql += sql2;
  398. #endif
  399. }
  400. }
  401. }
  402. #else
  403. if (msgcheck)
  404. {
  405. CString m_content3 = msgcontent;
  406. CString str,timestamp;
  407. timestamp="msgtimestamp";
  408. int pos=m_content3.Find("xxx先生/女士");
  409. if(pos!=-1)
  410. {
  411. if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0) )
  412. {
  413. str=m_content3;
  414. str.Replace ("xxx先生/女士", m_name1+"先生");
  415. int count=GetLengthEx(str)/MSG_LENGTH;
  416. if(GetLengthEx(str)%MSG_LENGTH)
  417. count++;
  418. CString scount;
  419. scount.Format ("%d", count);
  420. #if JEFF_TEST_ON
  421. sql2.Format(INSERT_SENDREG, _T("14"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
  422. sql += _T("***") + sql2;
  423. #else
  424. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  425. sql+=sql2;
  426. #endif
  427. }
  428. if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) )
  429. {
  430. str=m_content3;
  431. str.Replace ("xxx先生/女士", m_name2+"女士");
  432. int count=GetLengthEx(str)/MSG_LENGTH;
  433. if(GetLengthEx(str)%MSG_LENGTH)
  434. count++;
  435. CString scount;
  436. scount.Format ("%d", count);
  437. CTime tm=CTime::GetCurrentTime ();
  438. tm+=CTimeSpan(0,0,0,3);
  439. timestamp=tm.Format ("%Y%m%d%H%M%S");
  440. timestamp="msgtimexxstamp";
  441. #if JEFF_TEST_ON
  442. sql2.Format(INSERT_SENDREG, _T("14"), m_phone2, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
  443. sql += _T("***") + sql2;
  444. #else
  445. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  446. sql+=sql2;
  447. #endif
  448. }
  449. }
  450. }
  451. #endif
  452. }
  453. BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(128));//通知取件短信 128==msgcheck17
  454. CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(129);
  455. if (oldstatus2 == "OK")msgcheck = 0;
  456. if (m_status4 != "OK")msgcheck = 0;
  457. if (msgcheck)
  458. {
  459. CString sql2;
  460. #ifdef CHILD_VERSION
  461. if (msgcheck)
  462. {
  463. CString m_content3 = msgcontent;
  464. CString str, timestamp;
  465. timestamp = "msgtimestamp";
  466. {
  467. CString name;
  468. if (!m_name1.IsEmpty())
  469. name = m_name1 + ",";
  470. name += m_name2;
  471. name.TrimRight(",");
  472. if (name.IsEmpty() == 0 && CheckPhoneType(m_phone1) != -1 && CheckBadWords(name, 0))
  473. {
  474. str = name + m_content3;
  475. str.Replace("xxx小朋友", "");
  476. int count = GetLengthEx(str) / MSG_LENGTH;
  477. if (GetLengthEx(str) % MSG_LENGTH)
  478. count++;
  479. CString scount;
  480. scount.Format("%d", count);
  481. #if JEFF_TEST_ON
  482. sql2.Format(INSERT_SENDREG, _T("17"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  483. sql += _T("***") + sql2;
  484. #else
  485. sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone1 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  486. sql += sql2;
  487. #endif
  488. }
  489. }
  490. }
  491. #else
  492. if (msgcheck)
  493. {
  494. CString m_content3 = msgcontent;
  495. CString str,timestamp;
  496. timestamp="msgtimestamp";
  497. int pos=m_content3.Find("xxx先生/女士");
  498. if(pos!=-1)
  499. {
  500. if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0) )
  501. {
  502. str=m_content3;
  503. str.Replace ("xxx先生/女士", m_name1+"先生");
  504. int count=GetLengthEx(str)/MSG_LENGTH;
  505. if(GetLengthEx(str)%MSG_LENGTH)
  506. count++;
  507. CString scount;
  508. scount.Format ("%d", count);
  509. #if JEFF_TEST_ON
  510. sql2.Format(INSERT_SENDREG, _T("17"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  511. sql += _T("***") + sql2;
  512. #else
  513. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  514. sql+=sql2;
  515. #endif
  516. }
  517. if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) )
  518. {
  519. str=m_content3;
  520. str.Replace ("xxx先生/女士", m_name2+"女士");
  521. int count=GetLengthEx(str)/MSG_LENGTH;
  522. if(GetLengthEx(str)%MSG_LENGTH)
  523. count++;
  524. CString scount;
  525. scount.Format ("%d", count);
  526. CTime tm=CTime::GetCurrentTime ();
  527. tm+=CTimeSpan(0,0,0,3);
  528. timestamp=tm.Format ("%Y%m%d%H%M%S");
  529. timestamp="msgtimexxstamp";
  530. #if JEFF_TEST_ON
  531. sql2.Format(INSERT_SENDREG, _T("17"), m_phone2, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  532. sql += _T("***") + sql2;
  533. #else
  534. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  535. sql+=sql2;
  536. #endif
  537. }
  538. }
  539. }
  540. #endif
  541. }
  542. if (sql != "")
  543. {
  544. g_sendhead.bsql = 1;
  545. g_pMainWnd->ProcessChatMessageRequest2(sql);
  546. if (g_bSendOK == 0)return;
  547. }
  548. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  549. CDialog::OnOK();
  550. }
  551. void outsourcingDlg::OnButton1() // 全部完成按钮;
  552. {
  553. for (int i = 0; i < m_List1.GetItemCount(); i++)
  554. {
  555. if (m_List1.GetItemText(i, 8) == "OK")continue;
  556. m_List1.SetItemText(i, 8, "OK");
  557. m_List1.SetItemText(i, 9, g_date + "/" + g_user.name);
  558. }
  559. }
  560. void outsourcingDlg::OnButton2() // 全部取件按钮;
  561. {
  562. #ifdef LKAY_VERSION
  563. for (int i = 0; i < m_List1.GetItemCount(); i++)
  564. {
  565. if (m_List1.GetItemText(i, 14) == "OK")continue;
  566. m_List1.SetItemText (i, 14, "OK");
  567. m_List1.SetItemText (i, 15, g_date+"/"+g_user.name);
  568. }
  569. #else
  570. for (int i = 0; i < m_List1.GetItemCount(); i++)
  571. {
  572. if (m_List1.GetItemText(i, 10) == "OK")continue;
  573. m_List1.SetItemText(i, 10, "OK");
  574. m_List1.SetItemText(i, 11, g_date + "/" + g_user.name);
  575. }
  576. #endif
  577. }
  578. CString outsourcingDlg::GetLB(CString name)
  579. {
  580. for (int i = 0; i < m_List2array.GetSize(); i++)
  581. {
  582. if (name == m_List2array.ElementAt(i).ElementAt(1))
  583. return m_List2array.ElementAt(i).ElementAt(4);
  584. }
  585. return "";
  586. }
  587. void outsourcingDlg::OnTimer(UINT nIDEvent)
  588. {
  589. KillTimer(1);
  590. if (atof(m_money3)>0)
  591. {
  592. ShowMsg2 dlg;
  593. dlg.DoModal();
  594. // if(AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)
  595. // CDialog::OnCancel ();
  596. }
  597. CDialog::OnTimer(nIDEvent);
  598. }
  599. void outsourcingDlg::OnButton3() // 全部发出按钮;
  600. {
  601. POSITION pos;
  602. pos = m_List1.GetFirstSelectedItemPosition();
  603. if (pos == NULL)
  604. {
  605. AfxMessageBox("请先选中您要发出制作的产品!", MB_ICONINFORMATION);
  606. return;
  607. }
  608. SelProvider dlg;
  609. if (dlg.DoModal() != IDOK)return;
  610. int iItem;
  611. while (pos)
  612. {
  613. iItem = m_List1.GetNextSelectedItem(pos);
  614. m_List1.SetItemText(iItem, 4, dlg.m_provider);
  615. m_List1.SetItemText(iItem, 5, g_date + "/" + g_user.name);
  616. }
  617. }
  618. void outsourcingDlg::OnButton4() // 全部转走按钮;
  619. {
  620. for (int i = 0; i < m_List1.GetItemCount(); i++)
  621. {
  622. if (m_List1.GetItemText(i, 12) == "OK")continue;
  623. m_List1.SetItemText(i, 12, "OK");
  624. m_List1.SetItemText(i, 13, g_date + "/" + g_user.name);
  625. }
  626. }
  627. void outsourcingDlg::OnButton5() // 全部组件按钮;
  628. {
  629. for (int i = 0; i < m_List1.GetItemCount(); i++)
  630. {
  631. if (m_List1.GetItemText(i, 10) == "OK")continue;
  632. m_List1.SetItemText(i, 10, "OK");
  633. m_List1.SetItemText(i, 11, g_date + "/" + g_user.name);
  634. }
  635. }
  636. void outsourcingDlg::OnDestroy()
  637. {
  638. CDialog::OnDestroy();
  639. if (g_bAllBranch)
  640. {
  641. g_pMainWnd->OnDisconnect();
  642. g_bBranchModify = 0; g_branchip = g_branchname = "";
  643. }
  644. }