outsourcingDlg.cpp 23 KB

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