123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671 |
- // DesignFrom.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ylgl.h"
- #include "DesignFrom.h"
- #include "MyMdi.H"
- #include "ModifyDinDan.h"
- #include "InputPsw.h"
- #include "TakeMoney2.h"
- #include "ImportPhoto.h"
- #include "ClientRequirement.h"
- #include "ChoosePhotoSkin2.h"
- #include "./helper/ffsco.h"
- #include "SelectPhotoDlg.h"
- #include "ShowPic.h"
- #include "Login2.h"
- #include "ShowCut.h"
- #include "CompressOption.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- #pragma comment(lib, "Shlwapi.lib")
- IMPLEMENT_DYNCREATE(DesignFrom, MyFormView)
- DesignFrom::DesignFrom() : MyFormView(DesignFrom::IDD)
- {
- m_filter = _T("");
- m_nAdd = 0;
- if (g_bAllBranch)
- {
- m_nAdd = 1;
- }
- }
- DesignFrom::~DesignFrom()
- {
- }
- void DesignFrom::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(DesignFrom, 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_BUTexportphoto, OnBUTexportphoto)
- ON_BN_CLICKED(IDC_BUTimportphoto, OnBUTimportphoto)
- ON_BN_CLICKED(IDC_BUTTON2, OnButton2)
- ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST2, OnItemchangedList2)
- ON_BN_CLICKED(IDC_BUTimportphoto2, OnBUTimportphoto2)
- ON_BN_CLICKED(IDC_BUTimportphoto3, OnBUTimportphoto3)
- ON_NOTIFY(NM_CLICK, IDC_LIST2, OnClickList2)
- ON_BN_CLICKED(IDC_BUTTON3, OnButton3)
- ON_BN_CLICKED(IDC_BTNSEARCHFILTER, OnBtnsearchfilter)
- ON_BN_CLICKED(IDC_BUTprint3, OnBUTprint3)
- END_MESSAGE_MAP()
- #ifdef _DEBUG
- void DesignFrom::AssertValid() const
- {
- MyFormView::AssertValid();
- }
- void DesignFrom::Dump(CDumpContext& dc) const
- {
- MyFormView::Dump(dc);
- }
- #endif //_DEBUG
- /////////////////////////////////////////////////////////////////////////////
- void DesignFrom::OnInitialUpdate()
- {
- MyFormView::OnInitialUpdate();
- CMyMdi Mdi;
- Mdi.SetSubView((CWnd*)GetParent(), (CWnd*)this);
- GetDlgItem(IDC_BUTimportphoto3)->EnableWindow(IsHasRights2new(12));
- GetDlgItem(IDC_BUTTON3)->EnableWindow(IsHasRights2new(12));
- GetDlgItem(IDC_BUTshowphoto)->EnableWindow(IsHasRights2new(15));
- 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);
- if (g_bAllBranch == 0)
- {
- int idarray[] = { IDC_BUTexportphoto, IDC_BUTimportphoto, IDC_BUTimportphoto2, IDC_BUTimportphoto3, IDC_BUTshowphoto, IDC_BUTTON3, IDC_BUTclose };
- int idcount = 7;
- 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);
- }
- }
- else
- {
- GetDlgItem(IDC_BUTshowphoto)->ShowWindow(0);
- GetDlgItem(IDC_BUTprint3)->ShowWindow(1);
- int idarray[] = { IDC_BUTprint3, IDC_BUTexportphoto, IDC_BUTimportphoto, IDC_BUTimportphoto2, IDC_BUTimportphoto3, IDC_BUTTON3, IDC_BUTclose };
- int idcount = 7;
- 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);
- }
- }
- m_static1.SetFont(&g_titlefont);
- // Jeff.在精修状态后添加精修日期;
- if (g_bAllBranch == 0)
- {
- #ifdef CHILD_VERSION
- // 19 列;
- m_List1.SetHeadings("订单号,100;家长姓名,100;宝宝姓名,100;精修,100;精修日期,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;手机,100;固定电话,100");
- #else
- // 19 列;
- m_List1.SetHeadings("订单号,100;男宾姓名,100;女宾姓名,100;精修,100;精修日期,100;设计,100;设计日期,100;看设计,100;看设计日期,100;加急,100;取件日期,100;看设计要求,100;接单人,100;看设计人,100;设计师,100;套系名称,100;套系价格,100;男宾电话,100;女宾电话,100");
- #endif
- m_List1.LoadColumnInfo(119);
- }
- else
- {
- #ifdef CHILD_VERSION
- // 20 列;
- m_List1.SetHeadings("店名,100;订单号,100;家长姓名,100;宝宝姓名,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;套系价格,100;男宾电话,100;女宾电话,100");
- #endif
- m_List1.LoadColumnInfo(199);
- }
- GetData();
- m_combo1.AddString(g_user.name);
- 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_BUTexportphoto)->EnableWindow(IsHasRights2new(11));
- }
- void DesignFrom::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 != "")
- {
- // 查询条件==设计日期; 原本在列5
- if (m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) < g_filterdate1 || m_List1array.ElementAt(ii).ElementAt(6 + m_nAdd) > g_filterdate2)
- continue;
- }
- if (g_waiter1 != "")
- {
- // 查询条件==设计师; 原本在列13
- if (m_List1array.ElementAt(ii).ElementAt(14 + m_nAdd) != g_waiter1)
- continue;
- }
- if (g_bAllBranch && g_filterbranch != "")
- {
- if (m_List1array.ElementAt(ii).ElementAt(0) != g_filterbranch)
- 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++)
- {
- // 查询条件==精修状态&&设计状态(原本列4);
- if (m_List1array.ElementAt(ii).ElementAt(3 + m_nAdd) == "OK" && m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "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++)
- {
- // 查询条件==精修状态&&设计状态 &&(手机(原列16)||座机(原列17))
- if (m_List1array.ElementAt(ii).ElementAt(3 + m_nAdd) == "OK" &&
- m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "OK" &&
- (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).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(原列18)||拼音2(原列19))
- if (m_List1array.ElementAt(ii).ElementAt(3 + m_nAdd) == "OK"
- &&m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "OK"
- && (m_List1array.ElementAt(ii).ElementAt(19 + m_nAdd).Find(m_filter) != -1 || m_List1array.ElementAt(ii).ElementAt(20 + m_nAdd).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++)
- {
- // 查询条件==精修状态&&设计状态 &&(……)
- if (m_List1array.ElementAt(ii).ElementAt(3 + m_nAdd) == "OK" &&
- m_List1array.ElementAt(ii).ElementAt(5 + m_nAdd) != "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(3).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(14).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_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1 || \
- m_List1array.ElementAt(ii).ElementAt(19).Find(m_filter) != -1))
- {
- 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++)
- {
- // 查询条件==手机(原列16)||座机(原列17)
- if (m_List1array.ElementAt(ii).ElementAt(17 + m_nAdd).Find(m_filter) != -1 ||
- m_List1array.ElementAt(ii).ElementAt(18 + m_nAdd).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(原列18)||拼音2(原列19)
- if (m_List1array.ElementAt(ii).ElementAt(19 + m_nAdd).Find(m_filter) != -1 ||
- m_List1array.ElementAt(ii).ElementAt(20 + m_nAdd).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++)
- {
- 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(3).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(14).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_List1array.ElementAt(ii).ElementAt(17).Find(m_filter) != -1 ||
- m_List1array.ElementAt(ii).ElementAt(18).Find(m_filter) != -1 ||
- m_List1array.ElementAt(ii).ElementAt(19).Find(m_filter) != -1)
- {
- 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_nAdd))
- {
- m_List1.SetItemState(i, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
- m_List1.EnsureVisible(i, FALSE);
- break;
- }
- }
- }
- }
- void DesignFrom::OnBUTclose()
- {
- GetParent()->SendMessage(WM_CLOSE);
- }
- void DesignFrom::OnSelchangeCombo1()
- {
- SetTimer(1, 100, NULL);
- }
- void DesignFrom::OnTimer(UINT nIDEvent)
- {
- KillTimer(nIDEvent);
- OnButton1();
- }
- BOOL DesignFrom::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;
- }
- }
- else if (pMsg->message == WM_LBUTTONDBLCLK)
- {
- CPoint pt;
- CRect rc, rc2;
- ::GetCursorPos(&pt);
- m_List1.GetWindowRect(rc2);
- if (rc2.PtInRect(pt) == 0)
- return MyFormView::PreTranslateMessage(pMsg);
- pt.x -= rc2.left;
- pt.y -= rc2.top;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)return MyFormView::PreTranslateMessage(pMsg);
- int iItem = m_List1.GetNextSelectedItem(pos);
- m_List1.GetSubItemRect(iItem, 11 + m_nAdd, LVIR_BOUNDS, rc);
- if (rc.PtInRect(pt))
- {
- CClientRequirement dlg;
- CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- CString str;
- if (g_bAllBranch == 0)
- {
- for (int i = 0; i < m_List1arraybak.GetSize(); i++)
- {
- if (m_List1arraybak.ElementAt(i).ElementAt(0 + m_nAdd) == id)
- {
- str = m_List1arraybak.ElementAt(i).ElementAt(11 + m_nAdd);
- break;
- }
- }
- }
- else
- {
- CString branch = m_List1.GetItemText(iItem, 0);
- for (int i = 0; i < m_List1arraybak.GetSize(); i++)
- {
- if (m_List1arraybak.ElementAt(i).ElementAt(0 + m_nAdd) == id && branch == m_List1array.ElementAt(i).ElementAt(0))
- {
- str = m_List1arraybak.ElementAt(i).ElementAt(11 + m_nAdd);
- break;
- }
- }
- }
- dlg.m_bz2 = str;
- dlg.m_bSave = 0;
- dlg.DoModal();
- }
- }
- return MyFormView::PreTranslateMessage(pMsg);
- }
- catch (...)
- {
- }
- }
- extern 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 DesignFrom::GetSavePath(CString &path)
- {
- char lpszDisplayName[MAX_PATH], szFileName[MAX_PATH];
- LPITEMIDLIST pidlDesktop, pidlCurrent;
- if (SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidlDesktop) == NOERROR)
- {
- BROWSEINFO bi;
- bi.hwndOwner = this->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 DesignFrom::FindArray(CStringArray *pArray, CString Str)
- {
- for (int i = 0; i < pArray->GetSize(); i++)
- {
- if (pArray->ElementAt(i) == Str)
- return i;
- }
- return -1;
- }
- //-----------------------------------------------------------------
- // remark by Jeff 2014-12-12
- // 函数:GetNo
- // 描述:从str中解析出每个相片名,然后存入空的CStringArray中;
- // 参数:
- // str:选好的相片名串,如:"001,002,003" 后分隔符改为"|",结果应是"001|002|003"
- // array:空的数组,用来存放解析后的相片名;
- // 返回:
- // 注意:更换分隔符造成的问题,在该函数已解决;
- //-----------------------------------------------------------------
- void DesignFrom::GetNo(CString str, CStringArray &array)
- {
- if (!str.IsEmpty())
- {
- int pos = str.Find(",");
- while (pos != -1)
- {
- if (FindArray(&array, str.Left(pos)) == -1)
- array.Add(str.Left(pos));
- str = str.Right(str.GetLength() - pos - 1);
- pos = str.Find(",");
- }
- if (FindArray(&array, str) == -1)
- array.Add(str);
- }
- }
- //-----------------------------------------------------------------
- // remark by Jeff 2014-12-12
- // 函数:GetSelName
- // 描述:
- // 参数:
- // name:由GetNo解析出来后的单个相片名,如:"001"
- // spnamearray:订单下的商品数组,case 50所得;
- // 返回:
- // 注意:更换分隔符造成的问题,在该函数已解决;
- //-----------------------------------------------------------------
- CString DesignFrom::GetSelName(CString name, CArray<CStringArray, CStringArray>&spnamearray)
- {
- CString ret;
- name = "," + name + ",";
- CString str;
- for (int i = 0; i < spnamearray.GetSize(); i++)
- {
- str = "," + spnamearray.ElementAt(i).ElementAt(6) + ",";
- if (str.Find(name) != -1)
- {
- ret += spnamearray.ElementAt(i).ElementAt(5);
- ret += ";";
- }
- }
- ret.TrimRight(";");
- ret.Replace("*", "x");
- return ret;
- }
- //-----------------------------------------------------------------
- // remark by Jeff 2014-12-12
- // 函数:GetSelName2
- // 描述:
- // 参数:
- // name:由GetNo解析出来后的单个相片名,如:"001"
- // spnamearray:订单下的商品数组,case 50所得;
- // 返回:
- // 注意:更换分隔符造成的问题,在该函数已解决;
- //-----------------------------------------------------------------
- CString DesignFrom::GetSelName2(CString name, CArray<CStringArray, CStringArray>&spnamearray)
- {
- CString ret;
- name = "," + name + ",";
- CString str;
- for (int i = 0; i < spnamearray.GetSize(); i++)
- {
- str = "," + spnamearray.ElementAt(i).ElementAt(8) + ",";
- if (str.Find(name) != -1)
- {
- ret += spnamearray.ElementAt(i).ElementAt(5);
- ret += ";";
- }
- }
- ret.TrimRight(";");
- ret.Replace("*", "x");
- return ret;
- }
- void DesignFrom::OnBUTexportphoto() // 导出精修好的片 按钮;
- {
- if (IsHasRights2new(11) == 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 + m_nAdd);
- CString branch;
- if (g_bAllBranch)
- branch = m_List1.GetItemText(iItem, 0);
- CString path;
- if (g_bAllBranch)
- {
- CString branchpath = GetBranchPhotoPath(branch);
- path = g_path4 + branchpath + "\\";
- }
- else
- path = g_path4 + "\\";
- path += id;
- path += "\\";
- CStringArray array;
- CString dir;
- GetSavePath(dir);
- if (dir.IsEmpty())
- {
- return;
- }
- CString name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
- CString name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
- dir.TrimRight('\\');
- dir += "\\";
- dir += id;
- dir += g_branchname;
- if (g_bAllBranch)
- {
- if (GetBranchPhotoPath(branch) != "")
- dir += branch;
- }
- dir += name1;
- dir += name2;
- dir += "精修好的片";
- dir += "\\";
- ::CreateDirectory(dir, NULL);
- CStringArray desarray;
- CStringArray dirarray;
- CString savepath = dir;
- CString str;
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(path), 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 (FindArray(&dirarray, str) == -1)
- {
- dirarray.Add(str);
- if (str != dirarray.ElementAt(0))
- {
- str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
- if (::CheckFolderFileExist(str) == 0)
- ::CreateDirectory(str, NULL);
- }
- }
- }
- }
- if (1)
- {
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- array.Add(str);
- desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
- }
- }
- }
- if (array.GetSize() == 0)
- {
- AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
- return;
- }
- CCompressOption comoptdlg;
- comoptdlg.DoModal();
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- // 导出精修好片;
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- ImportPhoto dlg;
- dlg.m_nOutputSize = comoptdlg.m_nsize; // 1.导出精修片时的尺寸;
- dlg.m_mode = 1; // 2.未知;
- dlg.m_pArray = &array; // 3.作为导出源的精修片路径集合;
- dlg.m_pDesArray = &desarray; // 4.作为导出目标的精修片路径集合;
- dlg.m_savepath = dir; // 5.保存导出精修片的目录;
- dlg.DoModal();
- AfxMessageBox("导片成功!", MB_ICONINFORMATION);
- // CString str;
- str = " 导出精修片 ";
- str += "客人:";
- str += name1 + name2 + id;
- WriteLog(str);
- {
- ShowCut dlg;
- dlg.m_branch = branch;
- dlg.m_mode = 1;
- dlg.m_id = id;
- dlg.DoModal();
- }
- }
- void DesignFrom::OnBUTimportphoto() // 导入设计版 按钮;
- {
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要导片的定单!", MB_ICONINFORMATION);
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString branch;
- CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- if (g_bAllBranch)
- branch = m_List1.GetItemText(iItem, 0);
- // 原本4,5,改为5,6
- CString oldstatus = m_List1.GetItemText(iItem, 5 + m_nAdd);
- CString time10 = m_List1.GetItemText(iItem, 6 + m_nAdd);
- CString name = m_List1.GetItemText(iItem, 1 + m_nAdd) + "," + m_List1.GetItemText(iItem, 2 + m_nAdd);
- name.TrimLeft(",");
- name.TrimRight(",");
- name = "客人:" + name;
- CString phone = m_List1.GetItemText(iItem, 16 + m_nAdd) + "," + m_List1.GetItemText(iItem, 17 + m_nAdd);
- phone.TrimLeft(",");
- phone.TrimRight(",");
- phone = "电话:" + phone;
- #ifdef ENTERPRISE_VERSION
- if (::CheckFolderFileExist(g_path3) == 0)
- ::CreateDirectory(g_path3, NULL);
- #endif
- if (!::CheckFolderFileExist(g_path3))
- {
- AfxMessageBox("设计片保存机器目录未设置, 请通知系统管理员!", MB_ICONINFORMATION);
- return;
- }
- CString savepath;
- if (g_bAllBranch)
- {
- CString branchpath = GetBranchPhotoPath(branch);
- savepath = g_path3 + branchpath + "\\";
- if (::CheckFolderFileExist(savepath) == 0)
- ::CreateDirectory(savepath, NULL);
- }
- else
- savepath = g_path3 + "\\";
- savepath += id + "\\";
- if (::CheckFolderFileExist(savepath) == 0)
- ::CreateDirectory(savepath, NULL);
- /* IsGrowthTx growthtxdlg;
- growthtxdlg.m_id=id;
- growthtxdlg.DoModal ();
- if(growthtxdlg.m_bReturnOK==0)
- return;
- if(growthtxdlg.m_bGrowthTx && growthtxdlg.m_seltxname.IsEmpty ())
- return;
- if(!growthtxdlg.m_seltxname.IsEmpty ())
- {
- savepath+=growthtxdlg.m_seltxname+"\\";
- if(::CheckFolderFileExist (savepath)==0)
- ::CreateDirectory (savepath, NULL);
- }*/
- CString srcdir; CString str;
- GetSavePath(srcdir);
- if (srcdir.IsEmpty())
- {
- CString status5;
- if (AfxMessageBox("客照是否全部设计完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
- status5 = "OK";
- else
- status5 = "设计中";
- CString sql;
- if (time10.IsEmpty())
- sql = "update dindan set status5='" + status5 + "',time10='" + g_date + "' where id='" + id + "'";
- else
- sql = "update dindan set status5='" + status5 + "' where id='" + id + "'";
- g_sendhead.bsql = 1;
- if (g_bAllBranch)
- {
- g_branchip = GetIP(branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- else
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- if (g_bAllBranch == 0)
- {
- GetData();
- }
- else
- {
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
- {
- m_List1array.ElementAt(i).SetAt(4 + m_nAdd, status5);
- if (time10.IsEmpty())
- m_List1array.ElementAt(i).SetAt(5 + m_nAdd, g_date);
- FillGrid();
- break;
- }
- }
- }
- return;
- }
- if (srcdir.GetLength() < 4)
- {
- AfxMessageBox("请选择正确的您文件所在的目录!", MB_ICONSTOP);
- return;
- }
- if (oldstatus != "未设计")
- {
- CString str;
- str.Format("%s\r\n%s\r\n此单已导入过设计片, 确认您选中的照片没有导入过吗? 否则会覆盖原来的照片, 是否继续?", name, phone);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONSTOP) != IDYES)
- return;
- }
- else
- {
- CString str;
- str.Format("%s\r\n%s\r\n确认您选中的照片与客户资料相符吗? 是否继续?", name, phone);
- if (AfxMessageBox(str, MB_YESNO | MB_ICONINFORMATION) != IDYES)
- return;
- }
- CStringArray array;
- CStringArray desarray;
- CStringArray dirarray;
- if (1)
- {
- // 1.获取源目录下的所有子目录;
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(srcdir), 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 (FindArray(&dirarray, str) == -1)
- {
- dirarray.Add(str);
- if (str != dirarray.ElementAt(0))
- {
- str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
- if (::CheckFolderFileExist(str) == 0)
- ::CreateDirectory(str, NULL);
- }
- }
- }
- }
- if (1)
- {
- // 2.从每个子目录下查找所有的相片;
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- array.Add(str);
- desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
- }
- }
- }
- if (array.GetSize() == 0)return;
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- // 导入设计的片;
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- ImportPhoto dlg;
- dlg.m_branch = branch; // 1.订单分店名;
- dlg.m_nphototype = 3; // 2.未知;
- dlg.m_pArray = &array; // 3.作为源的设计片路径集合;
- dlg.m_pDesArray = &desarray; // 4.作为目标的设计片路径集合;
- dlg.m_savepath = savepath; // 5.导出时的保存目录;
- #ifdef ENTERPRISE_VERSION
- // if(!g_branchname.IsEmpty ())
- {
- dlg.m_bSaveUploadTask = g_bSaveUploadTask4;
- dlg.m_sel = g_cominfoarraylocal.ElementAt(0).ElementAt(81);
- dlg.m_uploadtaskarray.Add(id + ";" + name);
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- dlg.m_uploadtaskarray.Add("");
- }
- #endif
- dlg.DoModal();
- CString status5;
- if (AfxMessageBox("客照是否全部设计完毕?", MB_YESNO | MB_ICONINFORMATION) == IDYES)
- status5 = "OK";
- else
- status5 = "设计中";
- CString sql;
- if (time10.IsEmpty())
- sql = "update dindan set status5='" + status5 + "',waiter4='" + g_user.name + "',time10='" + g_date + "' where id='" + id + "'";
- else
- sql = "update dindan set status5='" + status5 + "',waiter4='" + g_user.name + "' where id='" + id + "'";
- g_sendhead.bsql = 1;
- if (g_bAllBranch)
- {
- g_branchip = GetIP(branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- else
- g_pMainWnd->ProcessChatMessageRequest2(sql);
- if (g_bSendOK == 0)return;
- savepath += "ok";
- ::DeleteFile(savepath);
- AfxMessageBox("导入客照成功!", MB_ICONINFORMATION);
- if (g_bAllBranch == 0)
- {
- GetData();
- }
- else
- {
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (id == m_List1array.ElementAt(i).ElementAt(1) && branch == m_List1array.ElementAt(i).ElementAt(0))
- {
- m_List1array.ElementAt(i).SetAt(4 + m_nAdd, status5);
- if (time10.IsEmpty())
- m_List1array.ElementAt(i).SetAt(5 + m_nAdd, g_date);
- m_List1array.ElementAt(i).SetAt(13 + m_nAdd, g_user.name);
- FillGrid();
- break;
- }
- }
- }
- }
- // Jeff:选设计版按钮;
- void DesignFrom::OnBUTshowphoto() //Jeff:选设计版按钮;
- {
- // TODO: Add your control notification handler code here
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString status = m_List1.GetItemText(iItem, 4);
- CString id = m_List1.GetItemText(iItem, 0);
- CString status2 = m_List1.GetItemText(iItem, 5);
- ChoosePhotoSkin2 dlg; // 选设计对话框;
- dlg.m_Runingmode = 1;
- dlg.SetLiaPath("3.lia");
- dlg.m_strOrderNumber = id;
- dlg.m_path = g_path3 + "\\";
- dlg.m_path += id;
- dlg.m_path += "\\";
- //AfxMessageBox(dlg.m_path);//Jeff Box;
- dlg.DoModal();
- g_bInSkin = 0;
- // 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;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- if (id == m_List1array.ElementAt(i).ElementAt(0))
- {
- m_List1array.ElementAt(i).SetAt(10, dlg.m_bz3);
- m_List1array.ElementAt(i).SetAt(6, dlg.m_status8);
- m_List1array.ElementAt(i).SetAt(9, dlg.m_time5);
- if (dlg.m_status8 != "OK")
- m_List1array.ElementAt(i).SetAt(4, "设计中");
- else
- m_List1array.ElementAt(i).SetAt(4, "OK");
- FillGrid();
- break;
- }
- }
- }
- void DesignFrom::OnButton1() // 查询 按钮;
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid();
- }
- // 已选未设计 按钮; "已选未设计"命名不合理,不知是"已选片OK未设计"还是"已精修未设计",意义待定
- void DesignFrom::OnButton2() // 已精修未设计 按钮;
- {
- UpdateData();
- m_filter.TrimLeft();
- m_filter.TrimRight();
- FillGrid(1);
- }
- void DesignFrom::OnItemchangedList2(NMHDR* pNMHDR, LRESULT* pResult)
- {
- NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- // CString waiter4=m_List1.GetItemText (iItem, 11);
- if (IsHasRights2new(7) || IsHasRights2new(49))
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
- // GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1);
- }
- else
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
- // GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(0);
- }
- /* if(waiter4.IsEmpty () && IsHasRights2new(7) || IsHasRights2new(49) )
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
- GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1);
- }
- else if(waiter4==g_user.name && IsHasRights2new(7) )
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(1);
- GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(1);
- }
- else
- {
- GetDlgItem(IDC_BUTimportphoto)->EnableWindow(0);
- GetDlgItem(IDC_BUTimportphoto2)->EnableWindow(0);
- }*/
- *pResult = 0;
- }
- void DesignFrom::OnBUTimportphoto2() // 查看 按钮;
- {
- POSITION pos;
- pos = m_List1.GetFirstSelectedItemPosition();
- if (pos == NULL)
- {
- AfxMessageBox("请先选中您要查看的定单!", MB_ICONINFORMATION);
- return;
- }
- int iItem = m_List1.GetNextSelectedItem(pos);
- CString branch;
- CString id = m_List1.GetItemText(iItem, 0 + m_nAdd);
- if (g_bAllBranch)
- branch = m_List1.GetItemText(iItem, 0);
- CString name = m_List1.GetItemText(iItem, 1 + m_nAdd) + "," + m_List1.GetItemText(iItem, 2 + m_nAdd);
- name.TrimLeft(",");
- name.TrimRight(",");
- name = "客人:" + name;
- ShowPic dlg;
- dlg.m_id = id;
- dlg.m_name = name;
- dlg.m_name2 = m_List1.GetItemText(iItem, 1 + m_nAdd) + m_List1.GetItemText(iItem, 2 + m_nAdd);
- // 设计要求(原列10)
- dlg.remark = m_List1.GetItemText(iItem, 11 + m_nAdd);
- dlg.m_mode = 5;
- if (g_bAllBranch)
- {
- dlg.m_branch = branch;
- CString branchpath = GetBranchPhotoPath(branch);
- dlg.m_path = g_path3 + branchpath + "\\";
- }
- else
- dlg.m_path = g_path3 + "\\";
- dlg.m_path += id;
- dlg.m_path += "\\";
- dlg.DoModal();
- }
- void DesignFrom::OnBUTimportphoto3() // 导出 (设计好的片) 按钮;
- {
- if (IsHasRights2new(12) == 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 + m_nAdd);
- CString branch;
- if (g_bAllBranch)
- branch = m_List1.GetItemText(iItem, 0);
- CString path;
- if (g_bAllBranch)
- {
- CString branchpath = GetBranchPhotoPath(branch);
- path = g_path3 + branchpath + "\\";
- }
- else
- path = g_path3 + "\\";
- path += id;
- path += "\\";
- CStringArray array;
- CString dir;
- GetSavePath(dir);
- if (dir.IsEmpty())
- {
- return;
- }
- CString name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
- CString name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
- CString remark = m_List1.GetItemText(iItem, 11 + m_nAdd); // 设计要求,原列10
- dir.TrimRight('\\');
- dir += "\\";
- dir += id;
- dir += g_branchname;
- if (g_bAllBranch)
- {
- if (GetBranchPhotoPath(branch) != "")
- dir += branch;
- }
- dir += name1;
- dir += name2;
- dir += "设计好的片";
- dir += "\\";
- ::CreateDirectory(dir, NULL);
- CStringArray desarray;
- CStringArray dirarray;
- CString savepath = dir;
- CString str;
- if (1)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(1);
- o.find(LPCSTR(path), 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 (FindArray(&dirarray, str) == -1)
- {
- dirarray.Add(str);
- if (str != dirarray.ElementAt(0))
- {
- str = savepath + str.Right(str.GetLength() - dirarray.ElementAt(0).GetLength());
- if (::CheckFolderFileExist(str) == 0)
- ::CreateDirectory(str, NULL);
- }
- }
- }
- }
- if (1)
- {
- for (int i = 0; i < dirarray.GetSize(); i++)
- {
- using namespace helper_coffs;
- ffsco o;
- o.dirs(0);
- o.find(LPCSTR(dirarray.ElementAt(i)), LPCSTR("*.jpg"));
- ffsco::typeT coo;
- ffsco::typeT::iterator it;
- coo = o.co_file();
- for (it = coo.begin(); coo.end() != it; it++)
- {
- str = (*it).c_str();
- if (str.GetAt(str.ReverseFind('\\') + 1) == 's')continue;
- if (str.GetAt(str.ReverseFind('\\') + 1) == 'm')continue;
- array.Add(str);
- desarray.Add(savepath + dirarray.ElementAt(i).Right(dirarray.ElementAt(i).GetLength() - dirarray.ElementAt(0).GetLength()) + str.Right(str.GetLength() - str.ReverseFind('\\') - 1));
- }
- }
- }
- if (array.GetSize() == 0)
- {
- AfxMessageBox("此单未导片!", MB_ICONINFORMATION);
- return;
- }
- CStdioFile fp;
- fp.Open(dir + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
- fp.WriteString(remark);
- fp.Close();
- CCompressOption comoptdlg;
- comoptdlg.DoModal();
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- // 导出设计好片;
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- ImportPhoto dlg;
- dlg.m_nOutputSize = comoptdlg.m_nsize; // 1.导出设计好的片的尺寸;
- dlg.m_mode = 1; // 2.未知;
- dlg.m_pArray = &array; // 3.作为导出时的源设计片路径集合;
- dlg.m_pDesArray = &desarray; // 4.作为导出时的目标设计片路径集合;
- dlg.m_savepath = dir; // 5.导出设计片时的保存路径;
- dlg.DoModal();
- AfxMessageBox("导片成功!", MB_ICONINFORMATION);
- // CString str;
- str = " 导出设计片 ";
- str += "客人:";
- str += name1 + name2 + id;
- WriteLog(str);
- }
- void DesignFrom::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 + m_nAdd);
- *pResult = 0;
- }
- // 需要处理更换分隔符造成的问题;
- // 已处理分隔符问题;
- void DesignFrom::OnButton3() // 导出选设计 按钮;
- {
- if (IsHasRights2new(12) == 0)return;
- UpdateData();
- 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 + m_nAdd);
- CString branch;
- if (g_bAllBranch)
- branch = m_List1.GetItemText(iItem, 0);
- CString name1 = m_List1.GetItemText(iItem, 1 + m_nAdd);
- CString name2 = m_List1.GetItemText(iItem, 2 + m_nAdd);
- #ifdef CHILD_VERSION
- CString filter = "id='" + id + "';id='" + id + "';id='" + id + "' and name<>'入册' and name<>'入底'";
- #else
- CString filter = "id='" + id + "';id='" + id + "';id='" + id + "' and kind<>'2' and name<>'入册' and name<>'入底'";
- #endif
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 50;
- g_sendhead.code[1] = 11;
- g_sendhead.code[2] = 56;
- g_sendhead.tabcount = 3;
- if (g_bAllBranch)
- {
- g_branchip = GetIP(branch);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- else
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- CArray<CStringArray, CStringArray>sparray;
- CArray<CStringArray, CStringArray>sparray2;
- DataToArray(&sparray, &g_List1array, &sparray2);
- CString path;
- if (g_bAllBranch)
- {
- CString branchpath = GetBranchPhotoPath(branch);
- path = g_path3 + branchpath + "\\";
- }
- else
- path = g_path3 + "\\";
- path += id;
- path += "\\";
- ////////////////////////////////////////
- CString str, spname;
- CStringArray noarray;
- CStringArray spnamearray;
- for (int i = 0; i < sparray.GetSize(); i++)
- {
- str = sparray.ElementAt(i).ElementAt(8);
- spname = sparray.ElementAt(i).ElementAt(5);
- GetNo(str, noarray);
- }
- if (noarray.GetSize() == 0)
- {
- AfxMessageBox("此单未选设计版!", MB_ICONINFORMATION);
- return;
- }
- spnamearray.SetSize(noarray.GetSize());
- for (i = 0; i < noarray.GetSize(); i++)
- {
- str = noarray.ElementAt(i);
- spnamearray.SetAt(i, GetSelName2(str, sparray));
- }
- CString dir;
- GetSavePath(dir);
- if (dir.IsEmpty())return;
- dir.TrimRight('\\');
- dir += "\\";
- dir += id;
- dir += g_branchname;
- if (g_bAllBranch)
- {
- if (GetBranchPhotoPath(branch) != "")
- dir += branch;
- }
- dir += name1;
- dir += name2;
- dir += "选设计";
- dir += "\\";
- CStringArray array;
- CStringArray spnamearray2;
- CString src, des;
- for (i = 0; i < noarray.GetSize(); i++)
- {
- src.Format("%s%s.jpg", path, noarray.ElementAt(i));
- if (PathFileExists(src))
- {
- array.Add(src);
- src = spnamearray.ElementAt(i);
- spnamearray2.Add(spnamearray.ElementAt(i));
- }
- else
- AfxMessageBox("未找到设计版:" + src.Right(src.GetLength() - src.ReverseFind('\\') - 1), MB_ICONINFORMATION);
- }
- ::CreateDirectory(dir, NULL);
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- // 导出选设计的片;
- //----------------------------------------------------------------------------------------------
- //----------------------------------------------------------------------------------------------
- ImportPhoto dlg;
- dlg.m_mode = 1; // 1.未知;
- dlg.m_bOrigin = 1; // 2.未知;
- dlg.m_pArray = &array; // 3.作为导出源的选好的设计片路径集合;
- dlg.m_pArray2 = &spnamearray2; // 4.作为导出目标的选好的设计片路径集合;
- dlg.m_savepath = dir; // 5.保存选好的设计片的目录;
- dlg.DoModal();
- //////////////
- if (g_List1array.GetSize())
- {
- CStdioFile fp;
- fp.Open(dir + "客户要求.txt", CFile::modeCreate | CFile::modeWrite);
- fp.WriteString("选设计要求:\n");
- fp.WriteString(g_List1array.ElementAt(0).ElementAt(57));
- fp.WriteString("\n");
- fp.WriteString("\n");
- fp.WriteString("设计版替换照片:\n");
- CString replace = g_List1array.ElementAt(0).ElementAt(59);
- if (!replace.IsEmpty())
- {
- replace.Delete(0, 1);
- replace.Replace("$", "\n");
- }
- fp.WriteString(replace);
- fp.WriteString("\n");
- fp.WriteString("\n");
- fp.WriteString("订单要求:\n");
- fp.WriteString(g_List1array.ElementAt(0).ElementAt(38));
- fp.WriteString("\n");
- fp.WriteString("\n");
- fp.WriteString("客人产品:\n");
- CString str;
- str = "产品名称";
- FillLength(str, 20);
- str += "数量";
- FillLength(str, 30);
- str += "加急";
- FillLength(str, 40);
- str += "取件日期";
- FillLength(str, 50);
- fp.WriteString(str);
- fp.WriteString("\n");
- for (int i = 0; i < sparray2.GetSize(); i++)
- {
- str.Empty();
- str = sparray2.ElementAt(i).ElementAt(0);
- FillLength(str, 20);
- str += sparray2.ElementAt(i).ElementAt(1);
- FillLength(str, 30);
- str += sparray2.ElementAt(i).ElementAt(18);
- FillLength(str, 40);
- str += sparray2.ElementAt(i).ElementAt(19);
- FillLength(str, 50);
- fp.WriteString(str);
- fp.WriteString("\n");
- }
- fp.Close();
- }
- //////////////
- AfxMessageBox("导片成功!", MB_ICONINFORMATION);
- // CString str;
- str = " 导出选设计片 ";
- str += "客人:";
- str += name1 + name2 + id;
- WriteLog(str);
- }
- void DesignFrom::HidePrice()
- {
- #ifdef LKAY_VERSION
- if (IsHasRights2new(31))return;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- m_List1array.ElementAt(i).SetAt(14 + m_nAdd, "***");
- m_List1array.ElementAt(i).SetAt(15 + m_nAdd, "***");
- m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
- m_List1array.ElementAt(i).SetAt(17 + m_nAdd, "***");
- }
- #else
- if (IsHasRights2new(31))return;
- for (int i = 0; i < m_List1array.GetSize(); i++)
- {
- m_List1array.ElementAt(i).SetAt(16 + m_nAdd, "***");
- m_List1array.ElementAt(i).SetAt(17 + m_nAdd, "***");
- }
- #endif
- }
- void DesignFrom::OnBtnsearchfilter() // 条件查询 按钮;
- {
- SearchFilter dlg;
- dlg.m_mode = 4;
- if (dlg.DoModal() == IDOK)FillGrid();
- g_bSearchFilter = 0;
- }
- void DesignFrom::GetData()
- {
- if (g_bAllBranch == 0)
- {
- 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] = 31;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)return;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 31;
- 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);
- }
- else
- {
- //////////////数据汇总
- m_List1array.RemoveAll();
- CString branch;
- for (int i = -1; i < g_brancharray.GetSize() - 1; i++)
- {
- if (i != -1)
- {
- branch = g_brancharray.ElementAt(i).ElementAt(0);
- g_branchip = g_brancharray.ElementAt(i).ElementAt(1);
- g_pMainWnd->OnDisconnect();
- g_branchname = branch;
- g_bBranchModify = 1;
- }
- else
- branch = g_brancharray.ElementAt(g_brancharray.GetSize() - 1).ElementAt(0);
- if (g_bShowOK == 0)
- {
- CString filter = "status3='未取'";
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 31;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(filter);
- if (g_bSendOK == 0)continue;
- }
- else
- {
- g_sendhead.bsql = 0;
- g_sendhead.code[0] = 31;
- g_sendhead.tabcount = 1;
- g_pMainWnd->ProcessChatMessageRequest2(1);
- if (g_bSendOK == 0)continue;
- }
- CArray<CStringArray, CStringArray>List1array;
- DataToArray(&List1array);
- int size = m_List1array.GetSize();
- for (int j = 0; j < List1array.GetSize(); j++)
- {
- size++;
- m_List1array.SetSize(size, 1);
- size--;
- m_List1array.ElementAt(size).Copy(List1array.ElementAt(j));
- m_List1array.ElementAt(size).InsertAt(0, branch);
- size++;
- }
- }
- g_pMainWnd->OnDisconnect();
- g_bBranchModify = 0;
- g_branchip = g_branchname = "";
- }
- m_List1arraybak.SetSize(m_List1array.GetSize(), 1);
- for (int ii = 0; ii < m_List1array.GetSize(); ii++)
- {
- m_List1arraybak.ElementAt(ii).Copy(m_List1array.ElementAt(ii));
- // 设计要求;原列10
- if (m_List1array.ElementAt(ii).ElementAt(11).GetLength() > 256)
- {
- m_List1array.ElementAt(ii).SetAt(11, m_List1array.ElementAt(ii).ElementAt(11).Left(256) + "...");
- }
- }
- HidePrice();
- FillGrid();
- }
- void DesignFrom::OnBUTprint3() // 更新数据 按钮;
- {
- GetData();
- }
|