From 6b09e3ea5d10ea60daaa668710c70082c9a386c3 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期三, 16 四月 2025 11:05:51 +0800 Subject: [PATCH] update --- jrj/project/total3/ViewTotalWin.cpp | 276 +++++++++++++++++++++++++++++------------------------- 1 files changed, 149 insertions(+), 127 deletions(-) diff --git a/jrj/project/total3/ViewTotalWin.cpp b/jrj/project/total3/ViewTotalWin.cpp index d330173..2feff78 100644 --- a/jrj/project/total3/ViewTotalWin.cpp +++ b/jrj/project/total3/ViewTotalWin.cpp @@ -4,33 +4,39 @@ #include <xcontrol/xcell.hpp> #include <xcontrol/xflowchart.hpp> #include <xcontrol/ximageview.hpp> +#include <xcontrol/xcombobox.hpp> + +#include <vbusiness/vutil/publiccode.vutil.vbusiness.hpp> +#include "viewobject/view.base.hpp" + using xml = KXMLDOMDocument; class __declspec(dllexport) ViewTotalWin : public xwin { public: ViewTotalWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} +public: static ViewTotalWin* CreateInstance(void* implPtr, void* hWnd) { return new ViewTotalWin(implPtr, (HWND)hWnd); } - +public: xdwgrid dw_list; xoffice dw_office; xcell dw_cell; xnode m_agentNode; //Agent Condition KXMLDOMElement rptEle; - string m_category; - string argStr; - string searchStr; - string fieldRoleStr; - int hWndImageView; - int hWndRetrieveTip; + xstring m_category; + xstring argStr; + xstring searchStr; + xstring fieldRoleStr; + HWND hWndImageView; + HWND hWndRetrieveTip; bool dataretrieveing; int SetAgent() { - string xfNodeAgentArea = L"agentarea"; + xstring xfNodeAgentArea = L"agentarea"; xnode anode = GetAgentNode(xfNodeAgentArea); if (m_agentNode) { @@ -42,7 +48,7 @@ KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); if (agent) { - string s = agent.xml(); + xstring s = agent.xml(); m_agentNode = SetAgentNode(anode, s); } } @@ -51,12 +57,12 @@ int OnSearch() { - xaserverarg arg = new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + xaserverarg arg ; + arg.AddArg(L"text", searchStr); //trace(searchStr); - OpenWindow(L"dev:xpage[search.dialog.vx]", cast(arg as int)); - string str = arg.GetArgString(L"text"); + OpenWindow(L"dev:xpage[search.dialog.vx]", arg); + xstring str = arg.GetArgString(L"text"); if (str != searchStr) { searchStr = str; @@ -67,7 +73,7 @@ } //焦点激活处理函数 - int OnSetFocus(ref TEvent evt, int param) + int OnSetFocus(TEvent * evt, int param) { //重置工具条 SetAgent(); @@ -75,25 +81,24 @@ } //命令发布函数 - int OnCmdDispatch(string comdid) + int OnCmdDispatch(xstring comdid) { - string UserNo = publiccode::GetUser().no; + xstring UserNo = publiccode::GetUser().no; int hCursor = 0; if (comdid == L"xmSearch") return OnSearch(); - + if (comdid == L"xmOwner") return OnOwnerData(); //if(UserNo !=L"00603") //{ if (comdid == L"xmAnalysis") { - hCursor = xutil::SetCursorWait(); - string str = dw_list.DataAnalysis(L""); - xaserverarg arg = new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + HCURSOR hCursor = xutil::SetCursorWait(); + xstring str = dw_list.DataAnalysis(L""); + xaserverarg arg ; + arg.AddArg(L"html", str); - int obj = cast(dw_list as int); - arg.AddArg(L"obj", obj.toString()); - OpenWindow(L"dev:xpage[data.vanalysis.vx]", cast(arg as int)); + arg.SetParam(L"obj",(LPARAM)&dw_list); + OpenWindow(L"dev:xpage[data.vanalysis.vx]", arg); xutil::RestoreCursor(hCursor); return 1; } @@ -104,20 +109,19 @@ } if (comdid == L"xmRemarks") { - string name = rptEle.getAttribute(L"name"); + xstring name = rptEle.getAttribute(L"name"); xml x = ViewObject::RetrieveData(L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); - KXMLDOMNodeList items = x.GetXmlDoc().selectNodes(L"data/Item"); + KXMLDOMNodeList items = x.selectNodes(L"data/Item"); KXMLDOMNode t = items.item(0); - string Content = L""; + xstring Content = L""; if (t.selectSingleNode(L"Content")) { - Content = t.selectSingleNode(L"Content").text; + Content = t.selectSingleNode(L"Content").text(); } - xaserverarg arg1 = new xaserverarg; - arg1.setNativePointer(arg1.CreateInstance()); + xaserverarg arg1 =GetArg(); arg1.AddArg(L"value", Content); - OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1.getNativePointer()); + OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1); return 1; } @@ -128,20 +132,20 @@ { if (rptEle) { - string argUrl = rptEle.getAttribute(L"arg"); + xstring argUrl = rptEle.getAttribute(L"arg"); if (argUrl != L"") { - xaserverarg ar = new xaserverarg; - ar.setNativePointer(ar.CreateInstance()); + xaserverarg ar ; + //ar.setNativePointer(ar.CreateInstance()); ar.AddArg(L"argurl", argUrl); if (argStr != L"") ar.AddArg(L"arg", argStr); - OpenWindow(L"dev:xpage[view.total.arg.vx]", cast(ar as int)); - string arstr = ar.GetArgString(L"arg"); + OpenWindow(L"dev:xpage[view.total.arg.vx]", ar); + xstring arstr = ar.GetArgString(L"arg"); if (arstr != L"" && ar.GetArgString(L"action") == L"ok") { argStr = arstr; - hCursor = xutil::SetCursorWait(); + HCURSOR hCursor = xutil::SetCursorWait(); //trace(rptEle.getAttribute(L"data")); OnRetrieve(rptEle.getAttribute(L"data"), argStr); xutil::RestoreCursor(hCursor); @@ -159,7 +163,7 @@ { int row = dw_list.GetRow(); - string skuid = dw_list.GetGuid(row); + xstring skuid = dw_list.GetGuid(row); OnLookImage(skuid); return 1; } @@ -172,25 +176,25 @@ return 0; } - int OnLookImage(string skuid) + int OnLookImage(xstring skuid) { - int hCursor = xutil::SetCursorWait(); - xaserverarg arg = ViewObject::MakeArg(); + HCURSOR hCursor = xutil::SetCursorWait(); + xaserverarg arg; arg.AddArg(L"guid", skuid); - OpenWindow(L"dev:xpage[ViewPictures.vx]", arg.getNativePointer()); + OpenWindow(L"dev:xpage[ViewPictures.vx]", arg); xutil::RestoreCursor(hCursor); return 1; } int AdjustField(xdwgrid dw) { - string str = fieldRoleStr; + xstring str = fieldRoleStr; for (int i = 1; i < dw.GetColumnCount(); i++) { - string colname = dw.GetColumnName(i); - if (str.find(L"!" + colname + L",L") >= 0) + xstring colname = dw.GetColumnName(i); + if (str.find(L"!" + colname + L",") >= 0) { - dw.SetColumnState(colname, false); + dw.SetColumnState((LPCTSTR)colname.c_str(), false); } } return 1; @@ -198,9 +202,9 @@ int SwitchReport(KXMLDOMElement e) { - string dwname = e.getAttribute(L"template"); - string dataurl = e.getAttribute(L"data"); - string sheettype = e.getAttribute(L"reporttype"); + xstring dwname = e.getAttribute(L"template"); + xstring dataurl = e.getAttribute(L"data"); + xstring sheettype = e.getAttribute(L"reporttype"); if (rptEle != e) { argStr = L""; @@ -209,7 +213,7 @@ if (sheettype == L"") sheettype = L"report"; SwitchLayer(L"dw_" + sheettype, L"report"); if (sheettype == L"report")dw_list.openUrl(dwname); - if (hWndImageView) win32::DestroyWindow(hWndImageView); + if (hWndImageView) DestroyWindow(hWndImageView); AdjustField(dw_list); @@ -217,15 +221,15 @@ return 1; } - int OnCombboChanged(ref TCommandEvent evt, int lParam) + int OnCombboChanged(TEvent* evt, int lParam) { - int h = xcombobox::GetCurSel(evt.hCtrl); + int h = xcombobox::GetCurSel(evt->command.hCtrl); if (h > -1) { - int hCursor = xutil::SetCursorWait(); - KXMLDOMElement e = xcombobox::GetItemData(evt.hCtrl, h); + HCURSOR hCursor = xutil::SetCursorWait(); + KXMLDOMElement e = xcombobox::GetItemData(evt->command.hCtrl, h); SwitchReport(e); - win32::PostMessage(GetHWND(), 0x401, L"xmQuery", 0); + PostMessage(GetHWND(), 0x401, (WPARAM)L"xmQuery", 0); //OnCmdDispatch(L"xmQuery"); xutil::RestoreCursor(hCursor); } @@ -234,13 +238,12 @@ int OnTransData() { - int ret = win32::MessageBox(GetHWND(), L"是否更新数据?\n更新过程预计需要四十分钟,如果中间弹出等待时间过长的提示,请点击中间重试按钮,或等待到一定时间再点击", L"提示", 0x4 /*yesno*/); + int ret = MessageBox(GetHWND(), L"是否更新数据?\n更新过程预计需要四十分钟,如果中间弹出等待时间过长的提示,请点击中间重试按钮,或等待到一定时间再点击", L"提示", 0x4 /*yesno*/); if (ret != 6 /*IDYES */) return 1; - xml x = new.xml(); - x.setNativePointer(xml::CreateInstance()); - int hCursor = xutil::SetCursorWait(); - if (url::get(L"/sale/data/Total3/total/transdata", L"", x) != 1) + xml x ; + HCURSOR hCursor = xutil::SetCursorWait(); + if (xurl::get(L"/sale/data/Total3/total/transdata", L"", x) != 1) { xutil::RestoreCursor(hCursor); return 1; @@ -255,71 +258,92 @@ return 1; } - //命令处理事件 - int OnXCommand(ref TXCommandEvent evt, int param) + int OnOwnerData() { - return OnCmdDispatch(evt.pStrID); + int ret = MessageBox(GetHWND(), L"是否更新归属数据?\n更新过程预计需要些时间,如果中间弹出等待时间过长的提示,请点击中间重试按钮,或等待到一定时间再点击", L"提示", 0x4 /*yesno*/); + if (ret != 6 /*IDYES */) return 1; + + xml x; + HCURSOR hCursor = xutil::SetCursorWait(); + if (xurl::get(L"/sale/data/CustomerV3/owner/reload", L"", x) != 1) + { + xutil::RestoreCursor(hCursor); + return 1; + } + else + { + xutil::RestoreCursor(hCursor); + alert(x.text()); + return 1; + } + + return 1; + } + //命令处理事件 + int OnXCommand(TEvent* evt, int param) + { + return OnCmdDispatch(evt->xcommand.pStrID); } int SendImageMessage(int row) { if (dw_list.GetItemString(row, L"GDNLineID") != L"") - win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GDNLineID:" + dw_list.GetItemString(row, L"GDNLineID"), 0); + SendMessage(hWndImageView, 0x401, (WPARAM)(L"xmRetrieve:GDNLineID:" + dw_list.GetItemString(row, L"GDNLineID")).c_str(),0); else if (dw_list.GetItemString(row, L"ItemID") != L"") - win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"ItemID"), 0); + SendMessage(hWndImageView, 0x401, (WPARAM)(L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"ItemID")).c_str(), 0); else if (dw_list.GetItemString(row, L"SKUID") != L"") - win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"SKUID"), 0); + SendMessage(hWndImageView, 0x401, (WPARAM)(L"xmRetrieve:SKUID:" + dw_list.GetItemString(row, L"SKUID")).c_str(), 0); else if (dw_list.GetItemString(row, L"GoodsNo") != L"") - win32::SendMessage(hWndImageView, 0x401, L"xmRetrieve:GoodsNo:" + dw_list.GetItemString(row, L"GoodsNo"), 0); + SendMessage(hWndImageView, 0x401, (WPARAM)(L"xmRetrieve:GoodsNo:" + dw_list.GetItemString(row, L"GoodsNo")).c_str(), 0); return 1; } - int OnDWClick(ref TNotifyEvent evt, int p) + int OnDWClick(TEvent* evt, int p) { - ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); - string value = hdr.data; - string colname = hdr.colname; + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; + xstring value = hdr.data; + xstring colname = hdr.colname; int row = hdr.row; if (row < 1) return 1; if (rptEle) { - string str = rptEle.getAttribute(L"forward"); + xstring str = rptEle.getAttribute(L"forward"); if (str == L"false") return 1; } /* - string s = publiccode::GetUser().id; + xstring s = publiccode::GetUser().id; xml supplier_x = ViewObject::RetrieveData(L"/sale/data/SupplierV3/entity/FindBySaleType",L"id", s); - if(supplier_x.GetXmlDoc().text == L"样品间" || supplier_x.GetXmlDoc().text == L"主管"){ + if(supplier_x.text == L"样品间" || supplier_x.text == L"主管"){ return 1; } xaserverarg arg; if(colname==L"SONo") { - string SONo = dw_list.GetItemString(row,colname); + xstring SONo = dw_list.GetItemString(row,colname); arg=new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"EntityNo",SONo); arg.AddArg(L"ReadOnly",L"true"); OpenWindow(L"dev:xpage[base.maint.so.vx]",arg.getNativePointer()); } if(colname==L"InvoiceNo") { - string InvoiceNo= dw_list.GetItemString(row,colname); + xstring InvoiceNo= dw_list.GetItemString(row,colname); arg=new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"EntityNo",InvoiceNo); arg.AddArg(L"ReadOnly",L"true"); OpenWindow(L"dev:xpage[maint.GDN3.vx]",arg.getNativePointer()); } if(colname==L"InvoiceNoEx") { - string InvoiceNoEx= dw_list.GetItemString(row,colname); + xstring InvoiceNoEx= dw_list.GetItemString(row,colname); arg=new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + arg.AddArg(L"EntityNo",InvoiceNoEx); arg.AddArg(L"invoiceno",InvoiceNoEx); arg.AddArg(L"ReadOnly",L"true"); @@ -327,28 +351,28 @@ } */ - if (hWndImageView != 0 && win32::IsWindow(hWndImageView)) + if (hWndImageView != 0 && IsWindow(hWndImageView)) { SendImageMessage(row); } else if (colname == L"HasImage") { - xwin pwin = OpenWindow(L"dev:xpage[testImage.vx]", 0); - hWndImageView = pwin.GetHWND(); + xwin* pwin = OpenWindow(L"dev:xpage[testImage.vx]", 0); + hWndImageView = pwin->GetHWND(); SendImageMessage(row); } return 1; } - int OnRowChanged(ref TNotifyEvent evt, int p) + int OnRowChanged(TEvent* evt, int p) { - ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; int row = hdr.row; if (row < 1) return 1; - if (hWndImageView != 0 && win32::IsWindow(hWndImageView)) + if (hWndImageView != 0 && IsWindow(hWndImageView)) { SendImageMessage(row); } @@ -358,20 +382,20 @@ int ShowRetrieveingTip() { dataretrieveing = true; - xwin pwin = OpenWindow(L"dev:xpage[TestRetrieveing.vx]", 0); - hWndRetrieveTip = pwin.GetHWND(); + xwin* pwin = OpenWindow(L"dev:xpage[TestRetrieveing.vx]", 0); + hWndRetrieveTip = pwin->GetHWND(); return 1; } int CloseRetrieveTip() { dataretrieveing = false; - win32::SendMessage(hWndRetrieveTip, 0x401, L"RetrieveFinished", 0); + SendMessage(hWndRetrieveTip, 0x401, (WPARAM)L"RetrieveFinished", 0); hWndRetrieveTip = 0; return 1; } - int OnRetrieveFinished(ref TNotifyEvent evt, int p) + int OnRetrieveFinished(TEvent* evt, int p) { CloseRetrieveTip(); //dataretrieveing = false; @@ -382,34 +406,35 @@ int OnAttachEvent() { //绑定工具条点击事件 - AttachEvent(L"WM_XCOMMAND", OnXCommand); + AttachEvent(L"WM_XCOMMAND", (FEvent)&ViewTotalWin::OnXCommand); //获取焦点事件,用于重置工具条 - AttachEvent(L"WM_SETFOCUS", OnSetFocus); - AttachEvent(L"cb_report", L"CBN_SELCHANGE", OnCombboChanged); - AttachEvent(L"dw_report", L"DWV_CLICKED", OnDWClick); - AttachEvent(L"dw_report", L"DWV_ROWFOCUSCHANGED", OnRowChanged);//绑定行更改触发事件OnRowChanged - AttachEvent(L"dw_report", (0x400 + 81).toString(), OnRetrieveFinished); + AttachEvent(L"WM_SETFOCUS", (FEvent)&ViewTotalWin::OnSetFocus); + AttachEvent(L"cb_report", L"CBN_SELCHANGE", (FEvent)&ViewTotalWin::OnCombboChanged); + AttachEvent(L"dw_report", L"DWV_CLICKED", (FEvent)&ViewTotalWin::OnDWClick); + AttachEvent(L"dw_report", L"DWV_ROWFOCUSCHANGED", (FEvent)&ViewTotalWin::OnRowChanged);//绑定行更改触发事件OnRowChanged + AttachEvent(L"dw_report", xstring(0x400 + 81), (FEvent)&ViewTotalWin::OnRetrieveFinished); + + return 1; } - int OnRetrieve(string dataurl, string argstr) + int OnRetrieve(xstring dataurl, xstring argstr) { if (!rptEle) return 0; if (dataretrieveing) return -1; dw_list.Reset(); - xml x = new.xml(); - x.setNativePointer(xml::CreateInstance()); - xaserverarg arg = new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + xml x ; + xaserverarg arg ; + arg.AddArg(L"arg", argstr); trace(argstr); - string sheettype = rptEle.getAttribute(L"reporttype"); + xstring sheettype = rptEle.getAttribute(L"reporttype"); if (sheettype == L"") sheettype = L"report"; //ShowRetrieveingTip(); - if (url::get(dataurl, arg.GetString(), x) != 1) + if (xurl::get(dataurl, arg.GetString(), x) != 1) { - trace(L"错误信息=L" + x.GetXmlDoc().text); + trace((xstring)L"错误信息=L" + x.text()); dw_list.Redraw(); return -1; } @@ -427,7 +452,7 @@ } else if (sheettype == L"office") { - dw_office.LoadTemplate(x); + dw_office.LoadTemplate(x,0); for (int i = 0; i < dw_office.GetSheetCount(); i++) { xcell sheet = dw_office.GetSheet(i); @@ -438,31 +463,29 @@ return 1; } - xml getReportSet(string category) + xml getReportSet(xstring category) { - xml x = new.xml(); - x.setNativePointer(xml::CreateInstance()); - xaserverarg arg = new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + xml x ; + xaserverarg arg ; + arg.AddArg(L"category", category); - if (url::get(L"/sale/data/Total3/reportset", arg.GetString(), x) != 1) + if (xurl::get(L"/sale/data/Total3/reportset", arg.GetString(), x) != 1) { return 0; } return x; } - string GetReportFieldRole() + xstring GetReportFieldRole() { - xml x = new.xml(); - x.setNativePointer(xml::CreateInstance()); - xaserverarg arg = new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); - if (url::get(L"/sale/data/Total3/report/field", arg.GetString(), x) != 1) + xml x ; + xaserverarg arg ; + + if (xurl::get(L"/sale/data/Total3/report/field", arg.GetString(), x) != 1) { - return ""; + return L""; } - string str = x.GetXmlDoc().text; + xstring str = x.text(); return str; } @@ -476,25 +499,24 @@ fieldRoleStr = GetReportFieldRole(); argStr = L""; - rptEle = 0; xcombobox xc = GetControl(L"cb_report"); m_category = L"total/trade"; - if (GetParam()) { - xaserverarg arg = new xaserverarg; - arg.setNativePointer(GetParam()); + SetArg(); + if (GetWinParam()) { + xaserverarg arg = GetArg(); m_category = arg.GetArgString(L"category"); } xml x = getReportSet(m_category); if (x) { - KXMLDOMNodeList nlist = x.GetXmlDoc().selectNodes(L"//reports/report"); - int len = nlist.length; + KXMLDOMNodeList nlist = x.selectNodes(L"//reports/report"); + int len = nlist.length(); for (int i = 0; i < len; i++) { KXMLDOMElement rpt = nlist.item(i); - string name = rpt.getAttribute(L"name"); - xcombobox::AddItem(xc.GetId(), name, trust(rpt as int)); + xstring name = rpt.getAttribute(L"name"); + xc.AddItem( name, rpt.ptr()); if (i == 0) xc.SetText(name); if (i == 0) rptEle = rpt; } -- Gitblit v1.9.3