outsourcingDlg.cpp 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696
  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. // 完成状态;
  327. if (m_List1.GetItemText(i, 8) == "OK" || m_List1.GetItemText(i, 10) == "OK")
  328. m_sparray.ElementAt(size + i).Add("1");
  329. else
  330. m_sparray.ElementAt(size + i).Add("0");
  331. #endif
  332. }
  333. }
  334. CMemFile memfile;
  335. CArchive ar(&memfile, CArchive::store);
  336. for (int ii = 0; ii < m_sparray.GetSize(); ii++)
  337. {
  338. m_sparray.ElementAt(ii).Serialize(ar);
  339. }
  340. ar.Close();
  341. int length = memfile.GetLength();
  342. BYTE *pData = memfile.Detach();
  343. int size = m_sparray.GetSize();
  344. BYTE *pData2 = new BYTE[length + sizeof(int)];
  345. memcpy(pData2, pData, length);
  346. memcpy(pData2 + length, &size, sizeof(int));
  347. delete[]pData;
  348. length += sizeof(int);
  349. g_nSendCode = 9;
  350. g_pMainWnd->ProcessChatMessageRequest2(pData2, length);
  351. g_nSendCode = 0;
  352. delete[]pData2;
  353. if (g_bSendOK == 0)return;
  354. sql = "";
  355. if (m_status3 == "OK" && m_bGrowthTX == 0)
  356. {
  357. sql = "update dindan set [status3]='" + m_status3 + "',[time5]='" + g_date + "' where id='" + m_id + "'";
  358. #if JEFF_TEST_ON
  359. // 2015-05-30 若取件状态OK,写日志;
  360. if ( m_status3 == _T("OK") )
  361. {
  362. CString strLog;
  363. strLog.Format(_T(" 订单:%s 在预约修改中被设置为取件OK"),m_id);
  364. WriteLog(_T("预约修改"), strLog);
  365. }
  366. #endif
  367. ////////////////////////
  368. CString sql2;
  369. BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(104)); // 104==msgcheck14
  370. CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(108);
  371. if (oldstatus == "OK")msgcheck = 0;
  372. #ifdef CHILD_VERSION
  373. if (msgcheck)
  374. {
  375. CString m_content3 = msgcontent;
  376. CString str, timestamp;
  377. timestamp = "msgtimestamp";
  378. {
  379. CString name;
  380. if (!m_name1.IsEmpty())
  381. name = m_name1 + ",";
  382. name += m_name2;
  383. name.TrimRight(",");
  384. if (name.IsEmpty() == 0 && CheckPhoneType(m_phone1) != -1 && CheckBadWords(name, 0))
  385. {
  386. str = name + m_content3;
  387. str.Replace("xxx小朋友", "");
  388. int count = GetLengthEx(str) / MSG_LENGTH;
  389. if (GetLengthEx(str) % MSG_LENGTH)
  390. count++;
  391. CString scount;
  392. scount.Format("%d", count);
  393. #if JEFF_TEST_ON
  394. sql2.Format(INSERT_SENDREG, _T("14"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
  395. sql += _T("***") + sql2;
  396. #else
  397. sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone1 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  398. sql += sql2;
  399. #endif
  400. }
  401. }
  402. }
  403. #else
  404. if (msgcheck)
  405. {
  406. CString m_content3 = msgcontent;
  407. CString str,timestamp;
  408. timestamp="msgtimestamp";
  409. int pos=m_content3.Find("xxx先生/女士");
  410. if(pos!=-1)
  411. {
  412. if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0) )
  413. {
  414. str=m_content3;
  415. str.Replace ("xxx先生/女士", m_name1+"先生");
  416. int count=GetLengthEx(str)/MSG_LENGTH;
  417. if(GetLengthEx(str)%MSG_LENGTH)
  418. count++;
  419. CString scount;
  420. scount.Format ("%d", count);
  421. #if JEFF_TEST_ON
  422. sql2.Format(INSERT_SENDREG, _T("14"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
  423. sql += _T("***") + sql2;
  424. #else
  425. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  426. sql+=sql2;
  427. #endif
  428. }
  429. if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) )
  430. {
  431. str=m_content3;
  432. str.Replace ("xxx先生/女士", m_name2+"女士");
  433. int count=GetLengthEx(str)/MSG_LENGTH;
  434. if(GetLengthEx(str)%MSG_LENGTH)
  435. count++;
  436. CString scount;
  437. scount.Format ("%d", count);
  438. CTime tm=CTime::GetCurrentTime ();
  439. tm+=CTimeSpan(0,0,0,3);
  440. timestamp=tm.Format ("%Y%m%d%H%M%S");
  441. timestamp="msgtimexxstamp";
  442. #if JEFF_TEST_ON
  443. sql2.Format(INSERT_SENDREG, _T("14"), m_phone2, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
  444. sql += _T("***") + sql2;
  445. #else
  446. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  447. sql+=sql2;
  448. #endif
  449. }
  450. }
  451. }
  452. #endif
  453. }
  454. BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(128));//通知取件短信 128==msgcheck17
  455. CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(129);
  456. if (oldstatus2 == "OK")msgcheck = 0;
  457. if (m_status4 != "OK")msgcheck = 0;
  458. if (msgcheck)
  459. {
  460. CString sql2;
  461. #ifdef CHILD_VERSION
  462. if (msgcheck)
  463. {
  464. CString m_content3 = msgcontent;
  465. CString str, timestamp;
  466. timestamp = "msgtimestamp";
  467. {
  468. CString name;
  469. if (!m_name1.IsEmpty())
  470. name = m_name1 + ",";
  471. name += m_name2;
  472. name.TrimRight(",");
  473. if (name.IsEmpty() == 0 && CheckPhoneType(m_phone1) != -1 && CheckBadWords(name, 0))
  474. {
  475. str = name + m_content3;
  476. str.Replace("xxx小朋友", "");
  477. int count = GetLengthEx(str) / MSG_LENGTH;
  478. if (GetLengthEx(str) % MSG_LENGTH)
  479. count++;
  480. CString scount;
  481. scount.Format("%d", count);
  482. #if JEFF_TEST_ON
  483. sql2.Format(INSERT_SENDREG, _T("17"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  484. sql += _T("***") + sql2;
  485. #else
  486. sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone1 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
  487. sql += sql2;
  488. #endif
  489. }
  490. }
  491. }
  492. #else
  493. if (msgcheck)
  494. {
  495. CString m_content3 = msgcontent;
  496. CString str,timestamp;
  497. timestamp="msgtimestamp";
  498. int pos=m_content3.Find("xxx先生/女士");
  499. if(pos!=-1)
  500. {
  501. if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0) )
  502. {
  503. str=m_content3;
  504. str.Replace ("xxx先生/女士", m_name1+"先生");
  505. int count=GetLengthEx(str)/MSG_LENGTH;
  506. if(GetLengthEx(str)%MSG_LENGTH)
  507. count++;
  508. CString scount;
  509. scount.Format ("%d", count);
  510. #if JEFF_TEST_ON
  511. sql2.Format(INSERT_SENDREG, _T("17"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  512. sql += _T("***") + sql2;
  513. #else
  514. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  515. sql+=sql2;
  516. #endif
  517. }
  518. if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) )
  519. {
  520. str=m_content3;
  521. str.Replace ("xxx先生/女士", m_name2+"女士");
  522. int count=GetLengthEx(str)/MSG_LENGTH;
  523. if(GetLengthEx(str)%MSG_LENGTH)
  524. count++;
  525. CString scount;
  526. scount.Format ("%d", count);
  527. CTime tm=CTime::GetCurrentTime ();
  528. tm+=CTimeSpan(0,0,0,3);
  529. timestamp=tm.Format ("%Y%m%d%H%M%S");
  530. timestamp="msgtimexxstamp";
  531. #if JEFF_TEST_ON
  532. sql2.Format(INSERT_SENDREG, _T("17"), m_phone2, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
  533. sql += _T("***") + sql2;
  534. #else
  535. sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
  536. sql+=sql2;
  537. #endif
  538. }
  539. }
  540. }
  541. #endif
  542. }
  543. if (sql != "")
  544. {
  545. g_sendhead.bsql = 1;
  546. g_pMainWnd->ProcessChatMessageRequest2(sql);
  547. if (g_bSendOK == 0)return;
  548. }
  549. AfxMessageBox("保存成功!", MB_ICONINFORMATION);
  550. CDialog::OnOK();
  551. }
  552. void outsourcingDlg::OnButton1() // 全部完成按钮;
  553. {
  554. for (int i = 0; i < m_List1.GetItemCount(); i++)
  555. {
  556. if (m_List1.GetItemText(i, 8) == "OK")continue;
  557. m_List1.SetItemText(i, 8, "OK");
  558. m_List1.SetItemText(i, 9, g_date + "/" + g_user.name);
  559. }
  560. }
  561. void outsourcingDlg::OnButton2() // 全部取件按钮;
  562. {
  563. #ifdef LKAY_VERSION
  564. for (int i = 0; i < m_List1.GetItemCount(); i++)
  565. {
  566. if (m_List1.GetItemText(i, 14) == "OK")continue;
  567. m_List1.SetItemText (i, 14, "OK");
  568. m_List1.SetItemText (i, 15, g_date+"/"+g_user.name);
  569. }
  570. #else
  571. for (int i = 0; i < m_List1.GetItemCount(); i++)
  572. {
  573. if (m_List1.GetItemText(i, 10) == "OK")continue;
  574. m_List1.SetItemText(i, 10, "OK");
  575. m_List1.SetItemText(i, 11, g_date + "/" + g_user.name);
  576. }
  577. #endif
  578. }
  579. CString outsourcingDlg::GetLB(CString name)
  580. {
  581. for (int i = 0; i < m_List2array.GetSize(); i++)
  582. {
  583. if (name == m_List2array.ElementAt(i).ElementAt(1))
  584. return m_List2array.ElementAt(i).ElementAt(4);
  585. }
  586. return "";
  587. }
  588. void outsourcingDlg::OnTimer(UINT nIDEvent)
  589. {
  590. KillTimer(1);
  591. if (atof(m_money3)>0)
  592. {
  593. ShowMsg2 dlg;
  594. dlg.DoModal();
  595. // if(AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)
  596. // CDialog::OnCancel ();
  597. }
  598. CDialog::OnTimer(nIDEvent);
  599. }
  600. void outsourcingDlg::OnButton3() // 全部发出按钮;
  601. {
  602. POSITION pos;
  603. pos = m_List1.GetFirstSelectedItemPosition();
  604. if (pos == NULL)
  605. {
  606. AfxMessageBox("请先选中您要发出制作的产品!", MB_ICONINFORMATION);
  607. return;
  608. }
  609. SelProvider dlg;
  610. if (dlg.DoModal() != IDOK)return;
  611. int iItem;
  612. while (pos)
  613. {
  614. iItem = m_List1.GetNextSelectedItem(pos);
  615. m_List1.SetItemText(iItem, 4, dlg.m_provider);
  616. m_List1.SetItemText(iItem, 5, g_date + "/" + g_user.name);
  617. }
  618. }
  619. void outsourcingDlg::OnButton4() // 全部转走按钮;
  620. {
  621. for (int i = 0; i < m_List1.GetItemCount(); i++)
  622. {
  623. if (m_List1.GetItemText(i, 12) == "OK")continue;
  624. m_List1.SetItemText(i, 12, "OK");
  625. m_List1.SetItemText(i, 13, g_date + "/" + g_user.name);
  626. }
  627. }
  628. void outsourcingDlg::OnButton5() // 全部组件按钮;
  629. {
  630. for (int i = 0; i < m_List1.GetItemCount(); i++)
  631. {
  632. if (m_List1.GetItemText(i, 10) == "OK")continue;
  633. m_List1.SetItemText(i, 10, "OK");
  634. m_List1.SetItemText(i, 11, g_date + "/" + g_user.name);
  635. }
  636. }
  637. void outsourcingDlg::OnDestroy()
  638. {
  639. CDialog::OnDestroy();
  640. if (g_bAllBranch)
  641. {
  642. g_pMainWnd->OnDisconnect();
  643. g_bBranchModify = 0; g_branchip = g_branchname = "";
  644. }
  645. }