123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696 |
- // outsourcingDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "outsourcingDlg.h"
- #include "ShowMsg2.h"
- #include "SelProvider.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // outsourcingDlg
- outsourcingDlg::outsourcingDlg(CWnd* pParent /*=NULL*/)
- : CDialog(outsourcingDlg::IDD)
- {
- //{{AFX_DATA_INIT(outsourcingDlg)IDC_COMBOid
- m_name1 = _T("");
- m_name2 = _T("");
- m_id = _T("");
- m_money1 = _T("");
- m_money2 = _T("");
- m_money3 = _T("");
- m_bGrowthTX = 0;
- //}}AFX_DATA_INIT
- }
- void outsourcingDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(outsourcingDlg)
- DDX_Control(pDX, IDC_LIST1, m_List1);
- DDX_Text(pDX, IDC_EDITname1, m_name1);
- DDX_Text(pDX, IDC_EDITname2, m_name2);
- DDX_Text(pDX, IDC_EDITid2, m_id);
- DDX_Text(pDX, IDC_EDITmoney1, m_money1);
- DDX_Text(pDX, IDC_EDITmoney2, m_money2);
- DDX_Text(pDX, IDC_EDITmoney3, m_money3);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(outsourcingDlg, CDialog)
- //{{AFX_MSG_MAP(outsourcingDlg)
- ON_BN_CLICKED(IDC_BUTclose, OnBUTclose)
- ON_BN_CLICKED(IDC_BUTTON1, OnButton1)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_WM_TIMER()
- ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- ON_BN_CLICKED(IDC_BUTTON4, OnButton4)
- ON_BN_CLICKED(IDC_BUTTON5, OnButton5)
- ON_WM_DESTROY()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- BOOL outsourcingDlg::PreTranslateMessage(MSG* pMsg)
- {
- if (0)//pMsg->message==WM_LBUTTONDBLCLK)
- {
- {//list1
- CPoint pt;
- CRect rc, rc2;
- ::GetCursorPos(&pt);
- m_List1.GetWindowRect(rc2);
- if (rc2.PtInRect(pt)) return 1;
- }
- }
- return CDialog::PreTranslateMessage(pMsg);
- }
- void outsourcingDlg::OnBUTclose()
- {
- CDialog::OnCancel();
- }
- void outsourcingDlg::GetData()
- {
- CArray<CStringArray, CStringArray>List1array;
- if (g_bAllBranch == 0)
- {
- #ifdef CHILD_VERSION
- CString filter = "id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
- #else
- CString filter = "id='" + m_id + "' and kind<>'2' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
- #endif
- g_sendhead.code[0] = 56; // dindansp表;
- g_sendhead.code[1] = 11; // dindan表;
- g_sendhead.code[2] = 9; // gongyingshang表;供应商信息
- g_sendhead.code[3] = 8; // shangpin表;
- g_sendhead.tabcount = 4;
- g_sendhead.bsql = 0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- DataToArray(&m_sparray, &List1array, &g_List1array, &m_List2array);
- }
- else
- {
- g_pMainWnd->OnDisconnect();
- g_branchip = GetIP(m_branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = m_branch;
- g_bBranchModify = 1;
- #ifdef CHILD_VERSION
- CString filter = "id='" + m_id + "' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
- #else
- CString filter = "id='" + m_id + "' and kind<>'2' and name<>'入册' and name<>'入底';id='" + m_id + "';;";
- #endif
- g_sendhead.code[0] = 56;
- g_sendhead.code[1] = 11;
- g_sendhead.code[2] = 9;//供应商信息
- g_sendhead.code[3] = 8;
- g_sendhead.tabcount = 4;
- g_sendhead.bsql = 0;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- DataToArray(&m_sparray, &List1array, &g_List1array, &m_List2array);
- }
- if ("成长套系" == List1array.ElementAt(0).ElementAt(52))
- m_bGrowthTX = 1;
- m_phone1 = List1array.ElementAt(0).ElementAt(61);
- m_phone2 = List1array.ElementAt(0).ElementAt(62);
- oldstatus = List1array.ElementAt(0).ElementAt(33);
- m_List1.DeleteAllItems();
- int listpos[3] = { 0 };
- CComboBoxListCtrl *pList[1] = { &m_List1 };
- int pos = 0;
- oldstatus2 = "OK";
- for (int i = 0; i < m_sparray.GetSize(); i++)
- {
- pList[pos]->InsertItem(listpos[pos], m_sparray.ElementAt(i).ElementAt(0));
- pList[pos]->SetItemText(listpos[pos], 1, m_sparray.ElementAt(i).ElementAt(1));
- #ifdef LKAY_VERSION
- pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt(i).ElementAt(29));
- pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt(i).ElementAt(30));
- #else
- pList[pos]->SetItemText(listpos[pos], 2, m_sparray.ElementAt(i).ElementAt(18));
- pList[pos]->SetItemText(listpos[pos], 3, m_sparray.ElementAt(i).ElementAt(19));
- #endif
- pList[pos]->SetItemText(listpos[pos], 4, m_sparray.ElementAt(i).ElementAt(2));
- pList[pos]->SetItemText(listpos[pos], 5, m_sparray.ElementAt(i).ElementAt(9) + "/" + m_sparray.ElementAt(i).ElementAt(10));
- pList[pos]->SetItemText(listpos[pos], 6, m_sparray.ElementAt(i).ElementAt(3));
- pList[pos]->SetItemText(listpos[pos], 7, m_sparray.ElementAt(i).ElementAt(11) + "/" + m_sparray.ElementAt(i).ElementAt(12));
- pList[pos]->SetItemText(listpos[pos], 8, m_sparray.ElementAt(i).ElementAt(4));
- pList[pos]->SetItemText(listpos[pos], 9, m_sparray.ElementAt(i).ElementAt(13) + "/" + m_sparray.ElementAt(i).ElementAt(14));
- #ifdef LKAY_VERSION
- pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt(i).ElementAt(23));
- pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt(i).ElementAt(25) + "/" + m_sparray.ElementAt(i).ElementAt(26));
- pList[pos]->SetItemText(listpos[pos], 12, m_sparray.ElementAt(i).ElementAt(24));
- pList[pos]->SetItemText(listpos[pos], 13, m_sparray.ElementAt (i).ElementAt (27)+"/"+m_sparray.ElementAt (i).ElementAt (28));
- pList[pos]->SetItemText(listpos[pos], 14, m_sparray.ElementAt (i).ElementAt (5));
- pList[pos]->SetItemText(listpos[pos], 15, m_sparray.ElementAt (i).ElementAt (15)+"/"+m_sparray.ElementAt (i).ElementAt (16));
- #else
- pList[pos]->SetItemText(listpos[pos], 10, m_sparray.ElementAt(i).ElementAt(5));
- pList[pos]->SetItemText(listpos[pos], 11, m_sparray.ElementAt(i).ElementAt(15) + "/" + m_sparray.ElementAt(i).ElementAt(16));
- #endif
- if (m_sparray.ElementAt(i).ElementAt(4) != "OK")
- oldstatus2 = "未完成";
- listpos[pos]++;
- }
- if (List1array.GetSize())
- {
- CString m_taoxijiage = List1array.ElementAt(0).ElementAt(8);
- CString m_payed4 = List1array.ElementAt(0).ElementAt(19);
- CString m_payed5 = List1array.ElementAt(0).ElementAt(20);
- m_money1 = List1array.ElementAt(0).ElementAt(1);
- m_money2.Format("%f", atof(m_payed5) + atof(m_money1));
- m_money1.Format("%f", atof(m_taoxijiage) + atof(m_payed4));
- m_money3.Format("%f", atof(m_money1) - atof(m_money2));
- ConvertToPrice(m_money1);
- ConvertToPrice(m_money2);
- ConvertToPrice(m_money3);
- UpdateData(false);
- }
- SetTimer(1, 500, NULL);
- }
- extern BOOL CALLBACK EnumChildProc2(HWND hwnd, LPARAM lParam);
- BOOL outsourcingDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- #ifdef CHILD_VERSION
- GetDlgItem(IDC_STATIC1)->SetWindowText("家长姓名:");
- GetDlgItem(IDC_STATIC2)->SetWindowText("宝宝姓名:");
- #endif
- CRect rc2;
- GetWindowRect(rc2);
- ::MoveWindow(m_hWnd, 0, g_rc.top, g_rc.left + g_rc.Width(), g_rc.Height(), TRUE);
- g_WidthScale2 = (float)(g_rc.left + g_rc.Width()) / (float)rc2.Width(); // new/Old
- g_HeightScale2 = (float)g_rc.Height() / (float)rc2.Height();
- EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc2, 0);
- m_List1.m_sparray = &m_sparray;
- m_List1.InitStyle();
- #ifdef LKAY_VERSION
- int idarray[] = { IDC_BUTTON3, IDC_BUTTON1, IDC_BUTTON5, IDC_BUTTON4, IDC_BUTTON2, IDOK, IDC_BUTclose };
- int idcount = 7;
- GetDlgItem(IDC_BUTTON4)->ShowWindow(SW_SHOW);
- GetDlgItem(IDC_BUTTON5)->ShowWindow(SW_SHOW);
- #else
- int idarray[] = { IDC_BUTTON3, IDC_BUTTON1, IDC_BUTTON2, IDOK, IDC_BUTclose };
- int idcount = 5;
- #endif
- int btnwid;
- CRect prerc;
- for (int a = idcount - 2; a >= 0; a--)
- {
- GetDlgItem(idarray[a + 1])->GetWindowRect(prerc);
- ScreenToClient(prerc);
- GetDlgItem(idarray[a])->GetWindowRect(rc2);
- ScreenToClient(rc2);
- btnwid = rc2.Width();
- rc2.right = prerc.left;
- rc2.left = rc2.right - btnwid;
- GetDlgItem(idarray[a])->MoveWindow(rc2);
- }
- #ifdef LKAY_VERSION
- m_List1.InsertColumn(0, _T("商品名称"), LVCFMT_LEFT, 160);
- m_List1.InsertColumn(1, _T("数量"), LVCFMT_LEFT, 50);
- // m_List1.InsertColumn(2,_T("加急"),LVCFMT_LEFT,50);
- // m_List1.InsertColumn(3,_T("取件日期"),LVCFMT_LEFT,100);
- m_List1.InsertColumn(2,_T("P数"),LVCFMT_LEFT,50);
- m_List1.InsertColumn(3,_T("张数"),LVCFMT_LEFT,100);
- m_List1.InsertColumn(4,_T("发出"),LVCFMT_LEFT,100);
- m_List1.InsertColumn(5,_T("发出日期"),LVCFMT_LEFT,140);
- m_List1.InsertColumn(6,_T("返工"),LVCFMT_LEFT,50);
- m_List1.InsertColumn(7,_T("返工日期"),LVCFMT_LEFT,140);
- m_List1.InsertColumn(8,_T("完成"),LVCFMT_LEFT,60);
- m_List1.InsertColumn(9,_T("完成日期"),LVCFMT_LEFT,140);
- m_List1.InsertColumn(10,_T("组件"),LVCFMT_LEFT,60);
- m_List1.InsertColumn(11,_T("组件日期"),LVCFMT_LEFT,140);
- m_List1.InsertColumn(12,_T("转走"),LVCFMT_LEFT,60);
- m_List1.InsertColumn(13,_T("转走日期"),LVCFMT_LEFT,140);
- m_List1.InsertColumn(14,_T("取走"),LVCFMT_LEFT,50);
- m_List1.InsertColumn(15,_T("取走日期"),LVCFMT_LEFT,140);
- #else
- m_List1.InsertColumn(0, _T("商品名称"), LVCFMT_LEFT, 160);
- m_List1.InsertColumn(1, _T("数量"), LVCFMT_LEFT, 50);
- m_List1.InsertColumn(2, _T("加急"), LVCFMT_LEFT, 50);
- m_List1.InsertColumn(3, _T("取件日期"), LVCFMT_LEFT, 100);
- m_List1.InsertColumn(4, _T("发出"), LVCFMT_LEFT, 100);
- m_List1.InsertColumn(5, _T("发出日期"), LVCFMT_LEFT, 140);
- m_List1.InsertColumn(6, _T("返工"), LVCFMT_LEFT, 50);
- m_List1.InsertColumn(7, _T("返工日期"), LVCFMT_LEFT, 140);
- m_List1.InsertColumn(8, _T("完成"), LVCFMT_LEFT, 60);
- m_List1.InsertColumn(9, _T("完成日期"), LVCFMT_LEFT, 140);
- m_List1.InsertColumn(10, _T("取走"), LVCFMT_LEFT, 50);
- m_List1.InsertColumn(11, _T("取走日期"), LVCFMT_LEFT, 140);
- #endif
- GetData();
- GetDlgItem(IDOK)->EnableWindow(IsHasRights2new(13));
- return TRUE;
- }
- void outsourcingDlg::OnOK() // 保存按钮;
- {
- if (IsHasRights2new(13) == 0)return;
- CString sql, str, m_status3, m_status4;
- m_status3 = "OK";
- m_status4 = "OK";
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- m_sparray.ElementAt(i).SetAt(2, m_List1.GetItemText(i, 4)); // 是否发出;
- m_sparray.ElementAt(i).SetAt(3, m_List1.GetItemText(i, 6)); // 是否返工;
- m_sparray.ElementAt(i).SetAt(4, m_List1.GetItemText(i, 8)); // 是否完成;
- #ifdef LKAY_VERSION
- m_sparray.ElementAt(i).SetAt(5, m_List1.GetItemText(i, 14));
- #else
- m_sparray.ElementAt(i).SetAt(5, m_List1.GetItemText(i, 10)); // 是否取走;
- #endif
- str = m_List1.GetItemText(i, 5); // 发出日期、谁发出;
- m_sparray.ElementAt(i).SetAt(9, str.Left(str.Find('/')));
- m_sparray.ElementAt(i).SetAt(10, str.Right(str.GetLength() - str.Find('/') - 1));
-
- str = m_List1.GetItemText(i, 7); // 返工日期、谁返工;
- m_sparray.ElementAt(i).SetAt(11, str.Left(str.Find('/')));
- m_sparray.ElementAt(i).SetAt(12, str.Right(str.GetLength() - str.Find('/') - 1));
-
- str = m_List1.GetItemText(i, 9); // 完成日期、谁完成;
- m_sparray.ElementAt(i).SetAt(13, str.Left(str.Find('/')));
- m_sparray.ElementAt(i).SetAt(14, str.Right(str.GetLength() - str.Find('/') - 1));
- #ifdef LKAY_VERSION
- m_sparray.ElementAt(i).SetAt(23, m_List1.GetItemText(i, 10));
- m_sparray.ElementAt(i).SetAt(24, m_List1.GetItemText(i, 12));
- str=m_List1.GetItemText (i, 11);
- m_sparray.ElementAt (i).SetAt (25, str.Left (str.Find ('/')) );
- m_sparray.ElementAt (i).SetAt (26, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
- str=m_List1.GetItemText (i, 13);
- m_sparray.ElementAt (i).SetAt (27, str.Left (str.Find ('/')) );
- m_sparray.ElementAt (i).SetAt (28, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
- str=m_List1.GetItemText (i, 15);
- m_sparray.ElementAt (i).SetAt (15, str.Left (str.Find ('/')) );
- m_sparray.ElementAt (i).SetAt (16, str.Right (str.GetLength ()-str.Find ('/')-1 ) );
- if(m_List1.GetItemText (i, 14)!="OK")
- m_status3="未取";
- if(m_List1.GetItemText (i, 8)!="OK")
- m_status4="未完成";
- #else
- str = m_List1.GetItemText(i, 11); // 取走日期、谁取走;
- m_sparray.ElementAt(i).SetAt(15, str.Left(str.Find('/')));
- m_sparray.ElementAt(i).SetAt(16, str.Right(str.GetLength() - str.Find('/') - 1));
- if (m_List1.GetItemText(i, 10) != "OK")
- m_status3 = "未取";
- if (m_List1.GetItemText(i, 8) != "OK")
- m_status4 = "未完成";
- #endif
- }
- if (m_status3 == "OK" && m_bGrowthTX == 0)
- {
- if (AfxMessageBox("全部取件后此单将存入历史数据库并不可修改, 确认吗?", MB_YESNO | MB_ICONINFORMATION) != IDYES)return;
- }
- if (atof(m_money3) > 0)
- if (AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- if (atof(m_money3) < 0)
- if (AfxMessageBox("警告:此客人账目不清, 请向财务核对, 继续吗?", MB_YESNO | MB_ICONSTOP) != IDYES)return;
- if (m_sparray.GetSize() == 0)
- {
- return;
- }
- if (1)//m_status3=="OK" && m_bGrowthTX==0)
- {//自动生成出库记录
- int size = m_sparray.GetSize();
- m_sparray.SetSize(size * 2);
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- m_sparray.ElementAt(size + i).RemoveAll();
- m_sparray.ElementAt(size + i).Add(m_id); // 订单号;
- m_sparray.ElementAt(size + i).Add(GetLB(m_List1.GetItemText(i, 0))); // 商品类别;
- m_sparray.ElementAt(size + i).Add(m_List1.GetItemText(i, 0)); // 商品名称;
- m_sparray.ElementAt(size + i).Add(m_List1.GetItemText(i, 1)); // 商品数量;
- #ifdef LKAY_VERSION
- if (m_List1.GetItemText(i, 8) == "OK" || m_List1.GetItemText(i, 14) == "OK")
- m_sparray.ElementAt(size + i).Add("1");
- else
- m_sparray.ElementAt (size+i).Add ("0");
- #else
- // 完成状态;
- if (m_List1.GetItemText(i, 8) == "OK" || m_List1.GetItemText(i, 10) == "OK")
- m_sparray.ElementAt(size + i).Add("1");
- else
- m_sparray.ElementAt(size + i).Add("0");
- #endif
- }
- }
- CMemFile memfile;
- CArchive ar(&memfile, CArchive::store);
- for (int ii = 0; ii < m_sparray.GetSize(); ii++)
- {
- m_sparray.ElementAt(ii).Serialize(ar);
- }
- ar.Close();
- int length = memfile.GetLength();
- BYTE *pData = memfile.Detach();
- int size = m_sparray.GetSize();
- BYTE *pData2 = new BYTE[length + sizeof(int)];
- memcpy(pData2, pData, length);
- memcpy(pData2 + length, &size, sizeof(int));
- delete[]pData;
- length += sizeof(int);
- g_nSendCode = 9;
- g_pMainWnd->ProcessChatMessageRequest2(pData2, length);
- g_nSendCode = 0;
- delete[]pData2;
- if (g_bSendOK == 0)return;
- sql = "";
- if (m_status3 == "OK" && m_bGrowthTX == 0)
- {
- sql = "update dindan set [status3]='" + m_status3 + "',[time5]='" + g_date + "' where id='" + m_id + "'";
- #if JEFF_TEST_ON
- // 2015-05-30 若取件状态OK,写日志;
- if ( m_status3 == _T("OK") )
- {
- CString strLog;
- strLog.Format(_T(" 订单:%s 在预约修改中被设置为取件OK"),m_id);
- WriteLog(_T("预约修改"), strLog);
- }
- #endif
- ////////////////////////
- CString sql2;
- BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(104)); // 104==msgcheck14
- CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(108);
- if (oldstatus == "OK")msgcheck = 0;
- #ifdef CHILD_VERSION
- if (msgcheck)
- {
- CString m_content3 = msgcontent;
- CString str, timestamp;
- timestamp = "msgtimestamp";
- {
- CString name;
- if (!m_name1.IsEmpty())
- name = m_name1 + ",";
- name += m_name2;
- name.TrimRight(",");
- if (name.IsEmpty() == 0 && CheckPhoneType(m_phone1) != -1 && CheckBadWords(name, 0))
- {
- str = name + m_content3;
- str.Replace("xxx小朋友", "");
- int count = GetLengthEx(str) / MSG_LENGTH;
- if (GetLengthEx(str) % MSG_LENGTH)
- count++;
- CString scount;
- scount.Format("%d", count);
- #if JEFF_TEST_ON
- sql2.Format(INSERT_SENDREG, _T("14"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
- sql += _T("***") + sql2;
- #else
- sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone1 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
- sql += sql2;
- #endif
- }
- }
- }
- #else
- if (msgcheck)
- {
- CString m_content3 = msgcontent;
- CString str,timestamp;
- timestamp="msgtimestamp";
- int pos=m_content3.Find("xxx先生/女士");
- if(pos!=-1)
- {
- if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0) )
- {
- str=m_content3;
- str.Replace ("xxx先生/女士", m_name1+"先生");
- int count=GetLengthEx(str)/MSG_LENGTH;
- if(GetLengthEx(str)%MSG_LENGTH)
- count++;
- CString scount;
- scount.Format ("%d", count);
- #if JEFF_TEST_ON
- sql2.Format(INSERT_SENDREG, _T("14"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
- sql += _T("***") + sql2;
- #else
- sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
- sql+=sql2;
- #endif
- }
- if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) )
- {
- str=m_content3;
- str.Replace ("xxx先生/女士", m_name2+"女士");
- int count=GetLengthEx(str)/MSG_LENGTH;
- if(GetLengthEx(str)%MSG_LENGTH)
- count++;
- CString scount;
- scount.Format ("%d", count);
- CTime tm=CTime::GetCurrentTime ();
- tm+=CTimeSpan(0,0,0,3);
- timestamp=tm.Format ("%Y%m%d%H%M%S");
- timestamp="msgtimexxstamp";
- #if JEFF_TEST_ON
- sql2.Format(INSERT_SENDREG, _T("14"), m_phone2, str, timestamp, scount, _T("0"), _T("0"), _T("0"),_T("系统自动发送"));
- sql += _T("***") + sql2;
- #else
- sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
- sql+=sql2;
- #endif
- }
- }
- }
- #endif
- }
- BOOL msgcheck = atoi(g_cominfoarray.ElementAt(0).ElementAt(128));//通知取件短信 128==msgcheck17
- CString msgcontent = g_cominfoarray.ElementAt(0).ElementAt(129);
- if (oldstatus2 == "OK")msgcheck = 0;
- if (m_status4 != "OK")msgcheck = 0;
- if (msgcheck)
- {
- CString sql2;
- #ifdef CHILD_VERSION
- if (msgcheck)
- {
- CString m_content3 = msgcontent;
- CString str, timestamp;
- timestamp = "msgtimestamp";
- {
- CString name;
- if (!m_name1.IsEmpty())
- name = m_name1 + ",";
- name += m_name2;
- name.TrimRight(",");
- if (name.IsEmpty() == 0 && CheckPhoneType(m_phone1) != -1 && CheckBadWords(name, 0))
- {
- str = name + m_content3;
- str.Replace("xxx小朋友", "");
- int count = GetLengthEx(str) / MSG_LENGTH;
- if (GetLengthEx(str) % MSG_LENGTH)
- count++;
- CString scount;
- scount.Format("%d", count);
- #if JEFF_TEST_ON
- sql2.Format(INSERT_SENDREG, _T("17"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
- sql += _T("***") + sql2;
- #else
- sql2 = "***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('" + m_phone1 + "','" + str + "','" + timestamp + "','" + scount + "','0','0','0','系统自动发送')";
- sql += sql2;
- #endif
- }
- }
- }
- #else
- if (msgcheck)
- {
- CString m_content3 = msgcontent;
- CString str,timestamp;
- timestamp="msgtimestamp";
- int pos=m_content3.Find("xxx先生/女士");
- if(pos!=-1)
- {
- if(m_name1.IsEmpty ()==0 && CheckPhoneType(m_phone1)!=-1 && CheckBadWords(m_name1,0) )
- {
- str=m_content3;
- str.Replace ("xxx先生/女士", m_name1+"先生");
- int count=GetLengthEx(str)/MSG_LENGTH;
- if(GetLengthEx(str)%MSG_LENGTH)
- count++;
- CString scount;
- scount.Format ("%d", count);
- #if JEFF_TEST_ON
- sql2.Format(INSERT_SENDREG, _T("17"), m_phone1, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
- sql += _T("***") + sql2;
- #else
- sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone1+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
- sql+=sql2;
- #endif
- }
- if(m_name2.IsEmpty ()==0 && CheckPhoneType(m_phone2)!=-1 && CheckBadWords(m_name2,0) )
- {
- str=m_content3;
- str.Replace ("xxx先生/女士", m_name2+"女士");
- int count=GetLengthEx(str)/MSG_LENGTH;
- if(GetLengthEx(str)%MSG_LENGTH)
- count++;
- CString scount;
- scount.Format ("%d", count);
- CTime tm=CTime::GetCurrentTime ();
- tm+=CTimeSpan(0,0,0,3);
- timestamp=tm.Format ("%Y%m%d%H%M%S");
- timestamp="msgtimexxstamp";
- #if JEFF_TEST_ON
- sql2.Format(INSERT_SENDREG, _T("17"), m_phone2, str, timestamp, scount, _T("0"), _T("0"), _T("0"), _T("系统自动发送"));
- sql += _T("***") + sql2;
- #else
- sql2="***insert into sendreg([phones],[content],[timestamp],[msgcount],[status],[issended],[isautosend],[ren]) values('"+m_phone2+"','"+str+"','"+timestamp+"','"+scount+"','0','0','0','系统自动发送')";
- sql+=sql2;
- #endif
- }
- }
- }
- #endif
- }
- if (sql != "")
- {
- g_sendhead.bsql = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- }
- AfxMessageBox("保存成功!", MB_ICONINFORMATION);
- CDialog::OnOK();
- }
- void outsourcingDlg::OnButton1() // 全部完成按钮;
- {
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- if (m_List1.GetItemText(i, 8) == "OK")continue;
- m_List1.SetItemText(i, 8, "OK");
- m_List1.SetItemText(i, 9, g_date + "/" + g_user.name);
- }
- }
- void outsourcingDlg::OnButton2() // 全部取件按钮;
- {
- #ifdef LKAY_VERSION
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- if (m_List1.GetItemText(i, 14) == "OK")continue;
- m_List1.SetItemText (i, 14, "OK");
- m_List1.SetItemText (i, 15, g_date+"/"+g_user.name);
- }
- #else
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- if (m_List1.GetItemText(i, 10) == "OK")continue;
- m_List1.SetItemText(i, 10, "OK");
- m_List1.SetItemText(i, 11, g_date + "/" + g_user.name);
- }
- #endif
- }
- CString outsourcingDlg::GetLB(CString name)
- {
- for (int i = 0; i < m_List2array.GetSize(); i++)
- {
- if (name == m_List2array.ElementAt(i).ElementAt(1))
- return m_List2array.ElementAt(i).ElementAt(4);
- }
- return "";
- }
- void outsourcingDlg::OnTimer(UINT nIDEvent)
- {
- KillTimer(1);
- if (atof(m_money3)>0)
- {
- ShowMsg2 dlg;
- dlg.DoModal();
- // if(AfxMessageBox("警告:此客人余款未清, 请向财务核对, 继续吗?", MB_YESNO|MB_ICONSTOP)!=IDYES)
- // CDialog::OnCancel ();
- }
- CDialog::OnTimer(nIDEvent);
- }
- void outsourcingDlg::OnButton3() // 全部发出按钮;
- {
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要发出制作的产品!", MB_ICONINFORMATION);
- return;
- }
- SelProvider dlg;
- if (dlg.DoModal() != IDOK)return;
- int iItem;
- while (pos)
- {
- iItem = m_List1.GetNextSelectedItem(pos);
- m_List1.SetItemText(iItem, 4, dlg.m_provider);
- m_List1.SetItemText(iItem, 5, g_date + "/" + g_user.name);
- }
- }
- void outsourcingDlg::OnButton4() // 全部转走按钮;
- {
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- if (m_List1.GetItemText(i, 12) == "OK")continue;
- m_List1.SetItemText(i, 12, "OK");
- m_List1.SetItemText(i, 13, g_date + "/" + g_user.name);
- }
- }
- void outsourcingDlg::OnButton5() // 全部组件按钮;
- {
- for (int i = 0; i < m_List1.GetItemCount(); i++)
- {
- if (m_List1.GetItemText(i, 10) == "OK")continue;
- m_List1.SetItemText(i, 10, "OK");
- m_List1.SetItemText(i, 11, g_date + "/" + g_user.name);
- }
- }
- void outsourcingDlg::OnDestroy()
- {
- CDialog::OnDestroy();
- if (g_bAllBranch)
- {
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0; g_branchip = g_branchname = "";
- }
- }
|