// ChoosePhotoForm.cpp : implementation file // #include "stdafx.h" #include "ylgl.h" #include "ChoosePhotoForm.h" #include "MyMdi.H" #include "ModifyDinDan.h" #include "ImportPhoto.h" #include "ChoosePhotoSkin2.h" #include "Login2.h" #include "ShowCut.h" #include "CompareContent.h" #include "SelBrunDevice.h" #include "DelHC.h" #include "DlgCloudSelection.h" #include "DlgCloundResult.h" using namespace helper_coffs; #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #pragma comment(lib, "Shlwapi.lib") ///////////////////////////////////////////////////////////////////////////// IMPLEMENT_DYNCREATE(ChoosePhotoForm, MyFormView) ChoosePhotoForm::ChoosePhotoForm(): MyFormView(ChoosePhotoForm::IDD) { m_filter = _T(""); } ChoosePhotoForm::~ChoosePhotoForm() { } void ChoosePhotoForm::DoDataExchange(CDataExchange* pDX) { MyFormView::DoDataExchange(pDX); DDX_Control(pDX, IDC_COMBO1, m_combo1); DDX_Control(pDX, IDC_LIST2, m_List1); DDX_Control(pDX, IDC_STATIC1, m_static1); DDX_CBString(pDX, IDC_COMBO1, m_filter); } BEGIN_MESSAGE_MAP(ChoosePhotoForm, MyFormView) ON_BN_CLICKED(IDC_BUTclose, OnBUTclose) ON_BN_CLICKED(IDC_BUTTON1, OnButton1) ON_CBN_SELCHANGE(IDC_COMBO1, OnSelchangeCombo1) ON_WM_TIMER() ON_BN_CLICKED(IDC_BUTshowphoto, OnBUTshowphoto) ON_BN_CLICKED(IDC_BUTmoney, OnBUTmoney) ON_BN_CLICKED(IDC_BUTexportphoto, OnBUTexportphoto) ON_BN_CLICKED(IDC_BUTTON2, OnButton2) ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2) ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter) ON_BN_CLICKED(IDC_BUTexportphoto2, OnBUTexportphoto2) ON_BN_CLICKED(IDC_BUTexportphoto3, OnBUTexportphoto3) ON_BN_CLICKED(BTN_ClounXP, OnBnClickedClounxp) ON_BN_CLICKED(BTN_ClounXPResult, OnBnClickedClounxpresult) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// #ifdef _DEBUG void ChoosePhotoForm::AssertValid() const { MyFormView::AssertValid(); } void ChoosePhotoForm::Dump(CDumpContext& dc) const { MyFormView::Dump(dc); } #endif //_DEBUG void ChoosePhotoForm::OnInitialUpdate() { MyFormView::OnInitialUpdate(); CMyMdi Mdi; Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this); CRect rc2; GetWindowRect(rc2); ::MoveWindow(m_hWnd, g_rc.left, g_rc.top, g_rc.Width(), g_rc.Height(), TRUE); EnumChildWindows(m_hWnd, (WNDENUMPROC)EnumChildProc, 0); int idarray[] = { IDC_BUTshowphoto, IDC_BUTexportphoto2, IDC_BUTexportphoto3, IDC_BUTexportphoto, IDC_BUTmoney, IDC_BUTclose }; int idcount = 6; 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); } // Jeff.在初修状态后添加精修日期; m_static1.SetFont(&g_titlefont); #ifdef CHILD_VERSION // 15列; m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;修片,100;修片日期,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;摄影师,100;初修师,100;套系名称,100;套系价格,100;手机,100;固定电话,100" ); #else m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;修片,100;修片日期,100;选片,100;选片日期,100;加挑金额,100;加挑张数,100;接单人,100;选片人,100;摄影师,100;初修师,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100"); #endif m_List1.LoadColumnInfo(116); if (g_bShowOK == 0) { #ifdef LKAY_VERSION CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)"; #else CString filter = "status3='未取'"; #endif g_sendhead.bsql = 0; g_sendhead.code[0] = 28; g_sendhead.tabcount = 1; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return; } else { g_sendhead.bsql = 0; g_sendhead.code[0] = 28; g_sendhead.tabcount = 1; #ifdef LKAY_VERSION CString filter="dindantype<>'意向客户' or dindantype is null"; g_pMainWnd->ProcessChatMessageRequest2(filter); #else g_pMainWnd->ProcessChatMessageRequest2(1); #endif if (g_bSendOK == 0)return; } DataToArray(&m_List1array); HidePrice(); m_combo1.AddString(g_user.name); for (int i = 0; i < g_userarray.GetSize(); i++) m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1)); FillGrid(); m_combo1.GetWindowRect(rc2); ScreenToClient(rc2); rc2.bottom += 200; m_combo1.MoveWindow(rc2); GetDlgItem(IDC_BUTclose)->GetWindowRect(rc2); SetComboHei(&m_combo1, rc2.Height()); GetDlgItem(IDC_BUTshowphoto)->EnableWindow(IsHasRights2new(15)); GetDlgItem(IDC_BUTexportphoto2)->EnableWindow(IsHasRights2new(15)); GetDlgItem(IDC_BUTexportphoto3)->EnableWindow(IsHasRights2new(15)); if ( !g_bEnableClound ) { GetDlgItem(BTN_ClounXP)->ShowWindow(SW_HIDE); GetDlgItem(BTN_ClounXPResult)->ShowWindow(SW_HIDE); } } void ChoosePhotoForm::FillGrid(BOOL bStatus) { if (g_bSearchFilter) // 条件查询; { m_List1.DeleteAllItems2(); int ii = 0; m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1); int count = 0; { for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==选片日期; if (g_filterdate1 != "") { if (m_List1array.ElementAt(ii).ElementAt(6) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(6) > g_filterdate2) continue; } // 查询条件==选片人; if (g_waiter1 != "") { if (m_List1array.ElementAt(ii).ElementAt(10) != g_waiter1) continue; } if(g_waiter2 != "") { if (m_List1array.ElementAt(ii).ElementAt(11) != g_waiter2) continue; } if(g_waiter3 != "") { if (m_List1array.ElementAt(ii).ElementAt(12) != g_waiter3) continue; } m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } m_List1.m_arLabels.SetSize(count, 1); ii = count; m_List1.m_LabelCount = ii; m_List1.SetItemCountEx(ii); CString str; str.Format("单数:%d", ii); SetDlgItemText(IDC_STATIC2, str); } else { m_List1.DeleteAllItems2(); int ii = 0; m_List1.m_arLabels.SetSize(m_List1array.GetSize(), 1); int count = 0; if (m_filter.IsEmpty()) { if (bStatus) // 已修未选; { for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==修片OK && 未选片; if (m_List1array.ElementAt(ii).ElementAt(3) == "OK" && m_List1array.ElementAt(ii).ElementAt(5) != "OK") m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } else { for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } } else { if (bStatus) // 已修未选; { int type = GetType(m_filter); if (type == 1)//电话 { for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==修片OK && 未选片 &&(手机1||手机2); if (m_List1array.ElementAt(ii).ElementAt(3) == "OK" && m_List1array.ElementAt(ii).ElementAt(5) != "OK" //&&(m_List1array.ElementAt (ii).ElementAt (12).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (13).Find (m_filter)!=-1)) && (m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1)) { m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } } else if (type == 2)//拼音 { m_filter.MakeUpper(); for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==修片OK && 未选片 &&(拼音1||拼音2); if (m_List1array.ElementAt(ii).ElementAt(3) == "OK" &&m_List1array.ElementAt(ii).ElementAt(5) != "OK" //&&(m_List1array.ElementAt (ii).ElementAt (14).Find (m_filter)!=-1 || m_List1array.ElementAt (ii).ElementAt (15).Find (m_filter)!=-1)) && (m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1)) { m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } } else { for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==修片OK && 未选片 &&(……); if (m_List1array.ElementAt(ii).ElementAt(3) == "OK" &&m_List1array.ElementAt(ii).ElementAt(5) != "OK" && ( m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || // 订单号; m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || // 男宾姓名; m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || // 女宾姓名; m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || // 接单人; m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || // 选片人; m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || // 摄影师; m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || // 初修师; m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || // 套系名称; m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || // 手机1 m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1)) // 手机2 { m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } } } else { int type = GetType(m_filter); if (type == 1)//电话 { for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==手机1 || 手机2; if (m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1) { m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } } else if (type == 2)//拼音 { m_filter.MakeUpper(); for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==拼音1 || 拼音2; if (m_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1) { m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } } else { for (ii = 0; ii < m_List1.m_arLabels.GetSize(); ii++) { // 查询条件==修片OK && 未选片 &&(……); if (m_List1array.ElementAt(ii).ElementAt(0).Find(m_filter) != -1 || // 订单号; m_List1array.ElementAt(ii).ElementAt(1).Find(m_filter) != -1 || // 男宾姓名; m_List1array.ElementAt(ii).ElementAt(2).Find(m_filter) != -1 || // 女宾姓名; m_List1array.ElementAt(ii).ElementAt(9).Find(m_filter) != -1 || // 接单人; m_List1array.ElementAt(ii).ElementAt(10).Find(m_filter) != -1 || // 选片人; m_List1array.ElementAt(ii).ElementAt(11).Find(m_filter) != -1 || // 摄影师; m_List1array.ElementAt(ii).ElementAt(12).Find(m_filter) != -1 || // 初修师; m_List1array.ElementAt(ii).ElementAt(13).Find(m_filter) != -1 || // 套系名称; m_List1array.ElementAt(ii).ElementAt(15).Find(m_filter) != -1 || // 手机1 m_List1array.ElementAt(ii).ElementAt(16).Find(m_filter) != -1) // 手机2 { m_List1.m_arLabels.ElementAt(count++).Copy(m_List1array.ElementAt(ii)); } } } } } m_List1.m_arLabels.SetSize(count, 1); ii = count; m_List1.m_LabelCount = ii; m_List1.SetItemCountEx(ii); CString str; str.Format("单数:%d", ii); SetDlgItemText(IDC_STATIC2, str); } if (!g_id.IsEmpty()) { for (int i = 0; i < m_List1.GetItemCount(); i++) { if (g_id == m_List1.GetItemText(i, 0)) { m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED); m_List1.EnsureVisible(i, FALSE); break; } } } } void ChoosePhotoForm::OnBUTclose() { GetParent()->SendMessage(WM_CLOSE); } void ChoosePhotoForm::OnSelchangeCombo1() { SetTimer(1, 100, NULL); } void ChoosePhotoForm::OnTimer(UINT nIDEvent) { KillTimer(nIDEvent); OnButton1(); } BOOL ChoosePhotoForm::PreTranslateMessage(MSG* pMsg) { try { if (pMsg->message == WM_KEYDOWN) { switch (pMsg->wParam) { case VK_RETURN: OnButton1(); return 1; case 0x43: // copy if ((GetKeyState(VK_CONTROL) & 0x80)) { GetFocus()->SendMessage(WM_COPY); return TRUE; } break; case 0x56: //Ctrl + V: if ((GetKeyState(VK_CONTROL) & 0x80)) { GetFocus()->SendMessage(WM_PASTE); return TRUE; } break; case 0x58: // cut if ((GetKeyState(VK_CONTROL) & 0x80)) { GetFocus()->SendMessage(WM_CUT); return TRUE; } break; case 0x5A: //undo case 0x59: //redo if ((GetKeyState(VK_CONTROL) & 0x80)) { GetFocus()->SendMessage(WM_UNDO); return TRUE; } break; } } } catch (...) { } return MyFormView::PreTranslateMessage(pMsg); } // Jeff.门市流程 - 选片 - 开始选片 void ChoosePhotoForm::OnBUTshowphoto() // Jeff.开始选片按钮; { if (IsHasRights2new(15) == 0) return; POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { AfxMessageBox("请先选中您要选片的定单!", MB_ICONINFORMATION); return; } int iItem = m_List1.GetNextSelectedItem(pos); CString id = m_List1.GetItemText(iItem, 0); CString status = m_List1.GetItemText(iItem, 4); // 选片状态; ChoosePhotoSkin2 dlg; dlg.m_strStatusOfChoosePhoto = status; dlg.SetLiaPath("3.lia"); dlg.m_strOrderNumber = id; dlg.m_path = g_path2 + "\\"; dlg.m_path += dlg.m_strOrderNumber; dlg.m_path += "\\"; // printf("Jeff:ChoosePhotoSkin2::m_id=%s\n ChoosePhotoSkin2::m_path=%s\n ChoosePhotoSkin2::m_mode\n\n",dlg.m_id,dlg.m_path,dlg.m_mode);// Jeff Printf; dlg.DoModal(); g_bInSkin = 0; if (dlg.m_bSave) { #if JEFF_TEST_ON if (g_bShowOK == 0) { #ifdef LKAY_VERSION CString filter="status3='未取' and (dindantype<>'意向客户' or dindantype is null)"; #else CString filter = "status3='未取'"; #endif //#ifdef LKAY_VERSION g_sendhead.bsql = 0; g_sendhead.code[0] = 28; g_sendhead.tabcount = 1; g_pMainWnd->ProcessChatMessageRequest2(filter); if (g_bSendOK == 0)return; } else { g_sendhead.bsql = 0; g_sendhead.code[0] = 28; g_sendhead.tabcount = 1; #ifdef LKAY_VERSION CString filter = "dindantype<>'意向客户' or dindantype is null"; g_pMainWnd->ProcessChatMessageRequest2(filter); #else g_pMainWnd->ProcessChatMessageRequest2(1); #endif //#ifdef LKAY_VERSION if (g_bSendOK == 0)return; } DataToArray(&m_List1array); HidePrice(); m_combo1.AddString(g_user.name); for (int i = 0; i < g_userarray.GetSize(); i++) { m_combo1.AddString(g_userarray.ElementAt(i).ElementAt(1)); } FillGrid(); #else for (int i = 0; i < m_List1array.GetSize(); i++) { if (id == m_List1array.ElementAt(i).ElementAt(0)) { m_List1array.ElementAt(i).SetAt(4+1, "OK"); m_List1array.ElementAt(i).SetAt(5+1, dlg.m_time4); m_List1array.ElementAt(i).SetAt(6+1, dlg.m_money3); m_List1array.ElementAt(i).SetAt(7+1, dlg.m_choosezs); if (status != "OK") // Jeff.若选片状态已经OK,则不刷新选片人2014.08.30 m_List1array.ElementAt(i).SetAt(9+1, dlg.m_waiter3); FillGrid(); break; } } #endif //#if JEFF_TEST_ON } } void ChoosePhotoForm::OnBUTmoney() // 查看裁剪 按钮; { POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { AfxMessageBox("请先选中您要查看的客人!", MB_ICONINFORMATION); return; } int iItem = m_List1.GetNextSelectedItem(pos); CString id = m_List1.GetItemText(iItem, 0); ShowCut dlg; dlg.m_mode = 2; dlg.m_strOrderNum = id; dlg.DoModal(); } void ChoosePhotoForm::OnBUTexportphoto() // 选片更改 按钮; { UpdateData(); POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { AfxMessageBox("请先选中您要对比的定单!", MB_ICONINFORMATION); return; } int iItem = m_List1.GetNextSelectedItem(pos); if (m_List1.GetItemText(iItem, 5) != "OK")return; CCompareContent dlg; dlg.m_id = m_List1.GetItemText(iItem, 0); dlg.DoModal(); } void ChoosePhotoForm::GetNo(CString str, CStringArray &array) { if (!str.IsEmpty()) { #ifdef USE_SEP_VEB int pos = str.Find(SEPS_VEB); #else int pos = str.Find(","); #endif while (pos != -1) { array.Add(str.Left(pos)); str = str.Right(str.GetLength() - pos - 1); #ifdef USE_SEP_VEB pos = str.Find(SEPS_VEB); #else pos = str.Find(","); #endif } array.Add(str); } } int CALLBACK BrowseProc(HWND hwnd, UINT msg, LPARAM lParam, LPARAM lpData) { switch (msg) { case BFFM_INITIALIZED: SendMessage(hwnd, BFFM_SETSELECTION, TRUE, NULL); break; case BFFM_SELCHANGED: { char szFileName[MAX_PATH]; LPITEMIDLIST pidlCurrent = (LPITEMIDLIST)lParam; SHGetPathFromIDList(pidlCurrent, szFileName); SendMessage(hwnd, BFFM_SETSTATUSTEXT, 0, (LPARAM)szFileName); } break; } return 0; } void GetSavePath(CString &path) { char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH]; LPITEMIDLIST pidlDesktop, pidlCurrent; if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop) == NOERROR) { BROWSEINFO bi; bi.hwndOwner = g_pMainWnd->m_hWnd; bi.pidlRoot = pidlDesktop; bi.pszDisplayName = lpszDisplayName; bi.lpszTitle = "\n文档保存的目录:"; bi.ulFlags = BIF_STATUSTEXT&BIF_RETURNONLYFSDIRS; bi.lpfn = BrowseProc; bi.lParam = 0; bi.iImage = 0; pidlCurrent = SHBrowseForFolder(&bi); SHGetPathFromIDList(pidlCurrent, szFileName); path = szFileName; } } int ChoosePhotoForm::FindArray(CStringArray *pArray, CString *pStr) { for (int i = 0; i < pArray->GetSize(); i++) { if (pArray->ElementAt(i) == *pStr) return i; } return -1; } void ChoosePhotoForm::OnButton1() // 查询 按钮; { UpdateData(); m_filter.TrimLeft(); m_filter.TrimRight(); FillGrid(); } void ChoosePhotoForm::OnButton2() // 已修未选 按钮; { UpdateData(); m_filter.TrimLeft(); m_filter.TrimRight(); FillGrid(1); } void ChoosePhotoForm::OnClickList2(NMHDR* pNMHDR, LRESULT* pResult) { POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL)return; int iItem = m_List1.GetNextSelectedItem(pos); g_id = m_List1.GetItemText(iItem, 0); *pResult = 0; } void ChoosePhotoForm::HidePrice() { #ifdef LKAY_VERSION if(IsHasRights2new(31))return; for(int i=0; i< m_List1array.GetSize (); i++) { m_List1array.ElementAt (i).SetAt (10, "***"); m_List1array.ElementAt (i).SetAt (11, "***"); m_List1array.ElementAt (i).SetAt (12, "***"); m_List1array.ElementAt (i).SetAt (13, "***"); m_List1array.ElementAt (i).SetAt (14, "***"); m_List1array.ElementAt (i).SetAt (15, "***"); m_List1array.ElementAt (i).SetAt (6, "***"); } #else if (IsHasRights2new(31))return; for (int i = 0; i < m_List1array.GetSize(); i++) { m_List1array.ElementAt(i).SetAt(15, "***"); m_List1array.ElementAt(i).SetAt(16, "***"); } #endif } void ChoosePhotoForm::OnBtnsearchfilter() // 条件查询 按钮; { SearchFilter dlg; dlg.m_mode = 4; if (dlg.DoModal() == IDOK) FillGrid(); g_bSearchFilter = 0; } BOOL ChoosePhotoForm::IsPhoto2Exist(CString m_id) { CString path2; CString path = g_path2 + "\\"; path += m_id; path += "\\"; using namespace helper_coffs; ffsco o; o.dirs(0); o.find(LPCSTR(path), LPCSTR("*.jpg")); ffsco::typeT coo; coo = o.co_file(); return coo.size(); } void ChoosePhotoForm::OnBUTexportphoto2() // 按钮 缓存本机; { POSITION pos; pos = m_List1.GetFirstSelectedItemPosition(); if (pos == NULL) { AfxMessageBox("请先选中您要缓存的定单!", MB_ICONINFORMATION); return; } ClearHC(); int iItem = m_List1.GetNextSelectedItem(pos); CString m_id = m_List1.GetItemText(iItem, 0); ////////////////////// CStringArray m_patharray1; int m_nChoosePhotoType = 0; // 0 = 初修片; 1 = 原片; if (m_patharray1.GetSize() == 0) { #if USE_SHARE_FLORD CStringArray photoArray; SelBrunDevice selbrundevicedlg; selbrundevicedlg.m_mode = 1; if (selbrundevicedlg.DoModal() == IDOK) m_nChoosePhotoType = selbrundevicedlg.m_sel; else m_nChoosePhotoType = 0; BOOL bGrowthTx = FALSE; CString strTxName = _T(""); GetTXName(&m_id, 1, bGrowthTx, strTxName); GetPhotosDir(m_id, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray); GetPhotoFiles(&photoArray, m_patharray1); /* SelBrunDevice selbrundevicedlg; selbrundevicedlg.m_mode = 1; if (selbrundevicedlg.DoModal() == IDOK) m_nChoosePhotoType = selbrundevicedlg.m_sel; else m_nChoosePhotoType = 0; BOOL bGrowthTx = FALSE; CString strTxName = _T(""); GetTXName(&m_id, 1, bGrowthTx, strTxName); CStringArray photoArray; if(m_nChoosePhotoType == 0) {// 初修片; for(int i = 0; i < 2; i++) { CStringArray patharr; GetPhotosDir(m_id, i, bGrowthTx, strTxName, photoArray); GetPhotoFiles(&photoArray, patharr); if(m_patharray1.GetSize() == 0) m_patharray1.Append(patharr); else { // 对比是否有同名的相片; for(int j=0; j 0) m_patharray1.Append(patharr); } } } else {// 原片; GetPhotosDir(m_id, m_nChoosePhotoType, bGrowthTx, strTxName, photoArray); GetPhotoFiles(&photoArray, m_patharray1); }*/ #else CString m_path, m_seltxname; m_path = g_path2 + "\\"; m_path += m_id; m_path += "\\"; if (IsPhoto2Exist(m_id)) { SelBrunDevice dlg; dlg.m_mode = 1; if (dlg.DoModal() == IDOK) m_nChoosePhotoType = dlg.m_sel; else m_nChoosePhotoType = 0; //m_nChoosePhotoType=0 原片+修片 1:修片 2:原片 } else AfxMessageBox("温馨提示:\r\n未找到初修片,将使用原片选片", MB_ICONINFORMATION); { CString path, path2; m_path = g_path1 + "\\"; m_path += m_id; m_path += "\\"; if (m_seltxname != "" && m_seltxname != "全部") { m_path += m_seltxname; m_path += "\\"; } if (m_nChoosePhotoType == 1) { m_path = g_path2 + "\\"; m_path += m_id; m_path += "\\"; } CString filename; ffsco o; o.dirs(1); o.find(LPCSTR(m_path), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { path = (*it).c_str(); if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm') { path.MakeLower(); filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1); if (filename.Find(".") != -1) filename = filename.Left(filename.Find(".")); if (!myisdigit(filename))continue; if (m_nChoosePhotoType == 1) { m_patharray1.Add(path); } else { path2 = path; if (m_nChoosePhotoType == 0) path2.Replace("客户原片", "修好的片"); if (1) { int pos = path2.Find(m_id); pos += m_id.GetLength(); int pos2 = path2.ReverseFind('\\'); path2 = path2.Left(pos) + path2.Right(path2.GetLength() - pos2); } if (m_nChoosePhotoType == 0 && ::PathFileExists(path2)) { m_patharray1.Add(path2); } else { path2.Replace(".raw", ".jpg"); if (::PathFileExists(path2)) { m_patharray1.Add(path2); continue; } path2.Replace(".nef", ".jpg"); if (::PathFileExists(path2)) { m_patharray1.Add(path2); continue; } path2.Replace(".cr2", ".jpg"); if (::PathFileExists(path2)) { m_patharray1.Add(path2); continue; } else { if (path.Right(3) != "jpg")continue; m_patharray1.Add(path); } } } } } } // if(0) {//多种修好的效果 CString path, path2; path2 = g_path2 + "\\"; path2 += m_id; path2 += "\\"; using namespace helper_coffs; ffsco o; o.dirs(0); o.find(LPCSTR(path2), LPCSTR("*.jpg")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin();coo.end() != it;it++) { path = (*it).c_str(); if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm') { path.MakeLower(); path2 = path.Right(path.GetLength() - path.ReverseFind('\\') - 1); if (path2.Find("-") != -1) { m_patharray1.Add(path); } } } } #endif //#if USE_SHARE_FLORD ///////////////////////// char path[MAX_PATH]; ::GetSystemDirectory(path, MAX_PATH); CString sysdir = path; sysdir += "\\lyfz"; ::CreateDirectory(sysdir, NULL); sysdir += "\\"; sysdir += m_id; ::CreateDirectory(sysdir, NULL); sysdir += "\\"; //---------------------------------------------------------------------------------------------- // 缓存到本机的相片; //---------------------------------------------------------------------------------------------- ImportPhoto dlg; dlg.m_bCopyToLocal = 1; dlg.m_mode = 1; dlg.m_pArray = &m_patharray1; dlg.m_savepath = sysdir; dlg.DoModal(); AfxMessageBox("缓存成功!"); } } CString GetCreateTime(CString path) { CFileFind finder; path.TrimRight("\\"); BOOL bWorking = finder.FindFile(path); if (bWorking) { finder.FindNextFile(); CTime tm; finder.GetCreationTime(tm); CTimeSpan dt = CTime::GetCurrentTime() - tm; int m_dtdays = AfxGetApp()->GetProfileInt(LYFZVERSION, "dtdays2", 5); if (dt.GetDays() >= m_dtdays) { ::DeleteDirectory(path); // 递归删除过期缓存; } } return ""; } void ChoosePhotoForm::ClearHC() { char path[MAX_PATH]; ::GetSystemDirectory(path, MAX_PATH); CString sysdir = path; sysdir += "\\lyfz"; ::CreateDirectory(sysdir, NULL); sysdir += "\\"; CString str; using namespace helper_coffs; ffsco o; o.dirs(0); o.find(LPCSTR(sysdir), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_dir(); for (it = coo.begin(); coo.end() != it; it++) { str = (*it).c_str(); if (str == sysdir)continue; GetCreateTime(str); } } void ChoosePhotoForm::OnBUTexportphoto3() // 管理缓存按钮; { DelHC dlg; dlg.DoModal(); } /************************************************************************/ /* 函数: GetTXName 描述: 获取套系名称 参数: const CString* pStrOrder, //订单号 const int nModle, // BOOL& bGrowthTx, //返回是否成长套系0否,1是 CString& strTxName //返回套系名 返回: */ /************************************************************************/ void ChoosePhotoForm::GetTXName(const CString* pStrOrder, const int nModle, BOOL& bGrowthTx, CString& strTxName) { if(pStrOrder == NULL || (*pStrOrder) == _T("")) return; IsGrowthTx growthtxdlg; growthtxdlg.m_mode = nModle; growthtxdlg.m_strOrderNumber = (*pStrOrder); growthtxdlg.DoModal(); bGrowthTx = growthtxdlg.m_bGrowthTx; strTxName = growthtxdlg.m_seltxname; } /************************************************************************/ /* 函数:GetPhotosDir[3/27/2016 IT]; /* 描述:获取相片目录; /* 参数:; /* [IN] strID: 订单号; /* [IN] nMode: =1:修片; =2:原片; /* [IN] bGrowthTx: 是否成长套系; /* [IN] strTxName: 套系名; /* [OUT] photoDirArr: 返回路径集合; /* 返回:void; /* 注意:; /* 示例:; /* /* 修改:; /* 日期:; /* 内容:; /************************************************************************/ void ChoosePhotoForm::GetPhotosDir(const CString& strID, const int nMode, const BOOL bGrowthTx, const CString& strTxName, CStringArray& photoDirArr) { TCHAR szShare[MAX_PATH] = {0}; TCHAR szOrdePath[MAX_PATH] = {0}; int i=0; int nSize = 0; switch(nMode) { case 0: // 初修; { sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("修好的片(管理软件)$")); // 若是成长套系,初修片有子目录; 若是婚纱版,初修没了景点了目录; if ( bGrowthTx && ( !strTxName.IsEmpty() && strTxName != _T("全部")) ) sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, strID, strTxName); else sprintf(szOrdePath, _T("%s\\%s"), szShare, strID); if ( PathFileExists(szOrdePath) ) photoDirArr.Add(CString(szOrdePath)); nSize = g_aryOfSharePathInfo.GetSize(); for (i = 0; i < nSize; i++) { if ( 2 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) ) { if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname) != 0 ) { continue; } // 逐一加载其他共享目录; // 如果是成长套系且套系名不为空或全部; sprintf(szShare,_T("%s"),g_aryOfSharePathInfo.ElementAt(i).ElementAt(2)); // 若是成长套系,初修片有子目录; 若是婚纱版,初修没了景点了目录; if ( bGrowthTx && ( !strTxName.IsEmpty() && strTxName != _T("全部")) ) sprintf(szOrdePath, _T("%s\\%s\\%s"), szShare, strID, strTxName); else sprintf(szOrdePath, _T("%s\\%s"), szShare, strID); if ( PathFileExists(szOrdePath) ) photoDirArr.Add(CString(szOrdePath)); } } } break; case 1: // 原片; { sprintf(szShare, _T("\\\\%s\\%s"), g_serverbak, _T("客户原片(管理软件)$")); sprintf(szOrdePath, _T("%s\\%s"), szShare, strID); if ( PathFileExists(szOrdePath) ) photoDirArr.Add(CString(szOrdePath)); nSize = g_aryOfSharePathInfo.GetSize(); for (i = 0; i < nSize; i++) { if ( 1 == atoi(g_aryOfSharePathInfo.ElementAt(i).ElementAt(5)) ) { if ( g_aryOfSharePathInfo.ElementAt(i).ElementAt(1).Compare(g_branchname.IsEmpty() ? g_domain : g_branchname) != 0 ) { continue; } // 逐一加载其他共享目录; sprintf(szShare,"%s",g_aryOfSharePathInfo.ElementAt(i).ElementAt(2)); sprintf(szOrdePath,"%s\\%s",szShare, strID); if ( PathFileExists(szOrdePath) ) photoDirArr.Add(CString(szOrdePath)); } } } break; } } /************************************************************************/ /* 函数: GetPhotoFiles 描述: 获取指定目录下的相片 参数: CStringArray* photoDirArr, 相片目录 CStringArray& filesArr 返回相片集 返回: */ /************************************************************************/ void ChoosePhotoForm::GetPhotoFiles(CStringArray* photoDirArr, CStringArray& filesArr) { if(photoDirArr == NULL) return; CString path = _T(""); CString filename = _T(""); for(int i=0; iGetSize(); i++) { ffsco o; o.dirs(1); o.find(LPCSTR(photoDirArr->ElementAt(i)), LPCSTR("*.*")); ffsco::typeT coo; ffsco::typeT::iterator it; coo = o.co_file(); for (it = coo.begin(); coo.end() != it; it++) { path = (*it).c_str(); if (path.GetAt(path.ReverseFind('\\') + 1) != 's' && path.GetAt(path.ReverseFind('\\') + 1) != 'm') { path.MakeLower(); filename = path.Right(path.GetLength() - path.ReverseFind('\\') - 1); if (filename.Find(".") != -1) filename = filename.Left(filename.Find(".")); if (!g_bOriginal && !myisdigit(filename)) continue; filesArr.Add(path); } } } } void ChoosePhotoForm::OnBnClickedClounxp() // 云选片; { // TODO: 在此添加控件通知处理程序代码 POSITION pos = m_List1.GetFirstSelectedItemPosition(); if ( pos == NULL) { AfxMessageBox(_T("请选中要使用云选片的订单!")); return ; } INT nItem = m_List1.GetNextSelectedItem(pos); CString strOrderNum = _T(""); CString strScenery = _T(""); CString strCustomerName = _T(""); CString strCustomerTel = _T(""); CString strStudioName = _T(""); CString strStudioTel = _T(""); CString strUniqueId = _T(""); CString strClounSite = _T(""); CString strTemp; strOrderNum = m_List1.GetItemText(nItem, 0); strCustomerName.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 1), m_List1.GetItemText(nItem,2)); #ifdef CHILD_VERSION // 15列; strCustomerTel.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 15), m_List1.GetItemText(nItem,16)); #else strCustomerTel.Format(_T("%s,%s"), m_List1.GetItemText(nItem, 15), m_List1.GetItemText(nItem,16)); #endif strStudioName = g_cominfoarray.ElementAt(0).ElementAt(10); strStudioTel = g_cominfoarray.ElementAt(0).ElementAt(11); strClounSite = m_List1.m_arLabels.ElementAt(nItem).ElementAt(19); INT nIndex = 0; strTemp = g_branchname.IsEmpty() ? g_domain : g_branchname; if ( ( nIndex = strTemp.Find(_T(".ly.com"))) == -1) { AfxMessageBox(_T("域名无效!")); return; } strTemp = strTemp.Left(nIndex); strTemp = strTemp.Right(6); strUniqueId.Format(_T("%s_A_%s_0"), strTemp, strOrderNum); if ( lyfzLibrary::LoadCloudSelectionLib() ) { CDlgCloudSelection dlg; dlg.SetParamters(0, strUniqueId, g_branchname.IsEmpty() ? g_domain : g_branchname, strStudioName, strStudioTel, strOrderNum,strScenery, m_List1.GetItemText(nItem, 1),m_List1.GetItemText(nItem, 2), m_List1.GetItemText(nItem, 15),m_List1.GetItemText(nItem, 16), strClounSite); dlg.DoModal(); lyfzLibrary::FreeCloudSelectionLib(); } else { AfxMessageBox(_T("加载云选片失败,请检查模块文件是否在客户目录下!")); } } void ChoosePhotoForm::OnBnClickedClounxpresult() { // TODO: 在此添加控件通知处理程序代码 #if 0 CArray AryCloundOrder; AryCloundOrder.SetSize(m_List1.m_arLabels.GetSize(),1); int i = 0; for ( i = 0; i < m_List1.m_arLabels.GetSize(); i++ ) { // 取出生成云链接的订单; AryCloundOrder.ElementAt(i).RemoveAll(); AryCloundOrder.ElementAt(i).Add(m_List1.m_arLabels.ElementAt(i).ElementAt(0)); // 订单号; AryCloundOrder.ElementAt(i).Add(m_List1.m_arLabels.ElementAt(i).ElementAt(19)); // 云地址; AryCloundOrder.ElementAt(i).Add(_T("")); // 用于存放选片结果,暂时置空; } INT nIndex = 0; CString strTemp = g_branchname.IsEmpty() ? g_domain : g_branchname; if ( ( nIndex = strTemp.Find(_T(".ly.com"))) == -1) { AfxMessageBox(_T("域名无效!")); return; } strTemp = strTemp.Left(nIndex); CString strBranchId = strTemp.Right(6); // 获取云选片结果; CString strUniqueId = _T(""); CArray AryJson; if ( lyfzLibrary::LoadCloudSelectionLib() ) { nIndex = 0; TCHAR szResultValue[8912] = {0}; for ( i = 0; i < AryCloundOrder.GetSize(); i++ ) { strUniqueId.Format(_T("%s_A_%s_0"), strBranchId, AryCloundOrder.ElementAt(i).ElementAt(0)); if ( ( nIndex = AryCloundOrder.ElementAt(i).ElementAt(1).Find(lyfzLibrary::g_strCloundHost)) != -1) { strTemp = AryCloundOrder.ElementAt(i).ElementAt(1).Mid(lyfzLibrary::g_strCloundHost.GetLength() + nIndex); lyfzLibrary::g_getcloundresult(0, strUniqueId, strTemp, szResultValue, 8912); AryCloundOrder.ElementAt(i).SetAt(2, szResultValue); // 解析Json; //lyfzLibrary::getXPJsonresult(szResultValue,AryJson); } } lyfzLibrary::FreeCloudSelectionLib(); } // 获取数据库保存的云数据; g_sendhead.bsql = 0; g_sendhead.code[0] = 241; g_sendhead.tabcount = 1; CString strFilter = _T("CloundType = 0"); CArray AryCloundInfo; g_pMainWnd->ProcessChatMessageRequest2(strFilter); if ( !g_bSendOK ) return; DataToArray(&AryCloundInfo); // 显示并同步结果; int j = 0; BOOL bExist = FALSE; CString strSQL = _T(""); for ( i = 0; i < AryCloundOrder.GetSize(); i++ ) { if ( AryCloundOrder.ElementAt(i).ElementAt(2).IsEmpty() ) continue; bExist = FALSE; for ( j = 0; j < AryCloundInfo.GetSize(); j++ ) { if ( AryCloundOrder.ElementAt(i).ElementAt(0) == AryCloundInfo.ElementAt(j).ElementAt(0) ) bExist = TRUE; } if ( bExist ) { if ( AryCloundOrder.ElementAt(i).ElementAt(2) == AryCloundInfo.ElementAt(j-1).ElementAt(4) ) continue; strSQL.Format(_T("update [CloundSelection] set [ResultJson] = '%s' where [order] = '%s'"), AryCloundOrder.ElementAt(i).ElementAt(0), AryCloundOrder.ElementAt(i).ElementAt(2)); } else strSQL.Format(_T("insert into [CloundSelection]( [order], [CloundType], [ResultJson]) values('%s', 0, '%s') "), AryCloundOrder.ElementAt(i).ElementAt(0), AryCloundOrder.ElementAt(i).ElementAt(2)); g_sendhead.bsql = true; g_pMainWnd->ProcessChatMessageRequest2(strSQL); } #endif CDlgCloundResult dlg; dlg.m_pList = &m_List1; POSITION pos = m_List1.GetFirstSelectedItemPosition(); if ( pos != NULL ) { INT nItem = m_List1.GetNextSelectedItem(pos); dlg.m_nSelItem = nItem; } dlg.DoModal(); }