From d4726c427464d5fa50c9fce848831c4cec36d8d1 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期三, 28 五月 2025 15:24:49 +0800 Subject: [PATCH] update --- jrj/project/business/BasicCode/brand.regtype.cpp | 298 +++++++++++++++++++++++++++++++---------------------------- 1 files changed, 155 insertions(+), 143 deletions(-) diff --git a/jrj/project/business/BasicCode/brand.regtype.cpp b/jrj/project/business/BasicCode/brand.regtype.cpp index 0fb0769..bdf4736 100644 --- a/jrj/project/business/BasicCode/brand.regtype.cpp +++ b/jrj/project/business/BasicCode/brand.regtype.cpp @@ -1,147 +1,159 @@ -use "frame.vl" -use "dev:vm[xdwtable.vm]" -use "file.vl" -use "dev:vm[xutil.vm]" +#include <wobject/xstring.hpp> +#include <xcontrol/xtreeview.hpp> +#include <xcontrol/xdwgrid.hpp> +#include <wobject/xdouble.hpp> +#include <xcontrol/xlayersheet.hpp> -unit vbusiness.entity -[ - brand_regtype is extend frame; - about brand_regtype - [ - method: - [ - xdwtable__ dw_list; - - int SetAgent() - { - string xfNodeAgentArea = "agentarea"; - xnode__ anode = new xnode__; - anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); - var xframeElement = GetElement(); - var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); - if(agent){ - SetAgentNodeContent (anode,agent.xml); - } - return 1; - } - - xdwtable__ getDw() - { - xdwtable__ dw1 = new xdwtable__; - dw1.setNativePointer(dw_list.FindDwTable("item")); - return dw1; - } - - int addRow() - { - xdwtable__ dw = getDw(); - int row = dw.InsertRow(0); - string no = "2"; - if(row > 1) - no = dw.GetItemString(row - 1, "RegTypeID"); - int n = no.toInt(); - int h = n + 1; - dw.SetItemString(row, "RegTypeID", h.toString()); - return 1; - } - int deleteRow() - { - xdwtable__ dw = getDw(); - int row = dw.GetRow(); - if(row < 1 || row > dw.GetRowCount()) return -1; - if (win__::MessageBox(this.GetHWND(),"是否删除选择的记录行?","提示",4) == 7) - return 1; - dw.DeleteRow(row); - return 1; - } - int save() - { - xml__ x = new xml__; - x.setNativePointer(xml__ ::CreateInstance()); - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - dw_list.AcceptText(); - dw_list.DwUpdateAllTo(x.GetXmlDoc()); - msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; - //trace(e.xml); - arg.AddArg("content", e.xml); - if(getUrl("/workflow/action/BrandRegType.dbmap/bill.update", arg.GetString(), x) != 1) - { - alert("保存失败!"); - return -1; - } - //trace(x.GetXml()); - string str = x.GetXml(); - if(str.find("保存成功", 0) > 0) - { - alert("保存成功"); - dw_list.ResetUpdateStatus(); - dw_list.Redraw(); - } - else - alert("保存失败0!"); - return 1; - } - - //命令发布函数 - int OnCmdDispatch(string comdid) - { - int hCursor = xutil__::SetCursorWait(); - if(comdid == "xmNew") addRow(); - else if(comdid == "xmDelete") deleteRow(); - else if(comdid == "xmSave") save(); - xutil__::RestoreCursor(hCursor); - return 0; - } - - //命令处理事件 - int OnXCommand(ref TXCommandEvent evt,int p) - { - return OnCmdDispatch(evt.pStrID); - } - - int OnSetFocus(ref TEvent evt,int p) - { - SetAgent() ; - return 1; - } - int OnAttachEvent() - { - AttachEvent("WM_XCOMMAND",OnXCommand); - AttachEvent("WM_SETFOCUS",OnSetFocus); - - return 1; - } - int Initail() - { - xaserverarg__ arg = new xaserverarg__; - arg.setNativePointer(arg.CreateInstance()); - xml__ x = new xml__; - x.setNativePointer(xml__ ::CreateInstance()); - if(getUrl("/sale/data/brand/entity/regtype", arg.GetString(), x) != 1) - { - alert("初始化查询失败!"); - return -1; - } - //trace(x.GetXml()); - dw_list.Retrieve(x); - dw_list.Redraw(); - return 1; - } +#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" +#include "viewobject/view.base.hpp" - int onload() +using xml = KXMLDOMDocument; +class __declspec(dllexport) brand_regtype : public xframe +{ +public: + xdwtable dw_list; + xnode m_agentNode; +public: + brand_regtype(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} +public: + static brand_regtype* CreateInstance(void* implPtr, void* hWnd) + { + brand_regtype* pWin = new brand_regtype(implPtr, (HWND)hWnd); + return pWin; + } + int SetAgent() + { + xstring xfNodeAgentArea = L"agentarea"; + xnode anode = GetAgentNode(xfNodeAgentArea); + if (m_agentNode) + { + SetAgentNode(anode, m_agentNode); + } + else + { + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); + if (agent) { - dw_list = new xdwtable__; - dw_list.setNativePointer(GetControl("dw_list")); - dw_list.openUrl("/sale/view/brand/template/regtype"); - //dw_list.SetColHeaderHeight(0); - dw_list.SetRowSelectorWidth(0); - - OnAttachEvent(); - SetAgent(); - Initail(); - return -1; + xstring s = agent.xml(); + m_agentNode = SetAgentNode(anode, s); } - ] - ] -] \ No newline at end of file + } + return 1; + } + + xdwtable getDw() + { + xdwtable dw1 = dw_list.FindDwTable(L"item"); + return dw1; + } + + int addRow() + { + xdwtable dw = getDw(); + int row = dw.InsertRow(0); + xstring no = L"2"; + if (row > 1) + no = dw.GetItemString(row - 1, L"RegTypeID"); + int n = no.toInt(); + int h = n + 1; + dw.SetItemString(row, L"RegTypeID", xstring(h)); + return 1; + } + int deleteRow() + { + xdwtable dw = getDw(); + int row = dw.GetRow(); + if (row < 1 || row > dw.GetRowCount()) return -1; + if (MessageBox(GetHWND(), L"是否删除选择的记录行?", L"提示", 4) == 7) + return 1; + dw.DeleteRow(row); + return 1; + } + int save() + { + xml x; + + xaserverarg arg; + + dw_list.AcceptText(); + dw_list.DwUpdateAllTo(x); + KXMLDOMElement e = x.documentElement(); + //trace(e.xml); + arg.AddArg(L"content", e.xml()); + if (getUrl(L"/workflow/action/BrandRegType.dbmap/bill.update", arg.GetString(), x) != 1) + { + alert(L"保存失败!"); + return -1; + } + //trace(x.xml()); + xstring str = x.xml(); + if (str.find(L"保存成功", 0) > 0) + { + alert(L"保存成功"); + dw_list.ResetUpdateStatus(); + dw_list.Redraw(); + } + else + alert(L"保存失败0!"); + return 1; + } + + //命令发布函数 + int OnCmdDispatch(xstring comdid) + { + HCURSOR hCursor = xutil::SetCursorWait(); + if (comdid == L"xmNew") addRow(); + else if (comdid == L"xmDelete") deleteRow(); + else if (comdid == L"xmSave") save(); + xutil::RestoreCursor(hCursor); + return 0; + } + + //命令处理事件 + int OnXCommand(TEvent* evt, LPARAM param) + { + return OnCmdDispatch(evt->xcommand.pStrID); + } + + int OnSetFocus(TEvent* evt, LPARAM p) + { + SetAgent(); + return 1; + } + int OnAttachEvent() + { + AttachEvent(L"WM_XCOMMAND", (FEvent)&brand_regtype::OnXCommand); + AttachEvent(L"WM_SETFOCUS", (FEvent)&brand_regtype::OnSetFocus); + + return 1; + } + int Initail() + { + xaserverarg arg; + + xml x; + if (getUrl(L"/sale/data/brand/entity/regtype", arg.GetString(), x) != 1) + { + alert(L"初始化查询失败!"); + return -1; + } + //trace(x.xml()); + dw_list.Retrieve(x); + dw_list.Redraw(); + return 1; + } + + int onload() + { + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"/sale/view/brand/template/regtype"); + //dw_list.SetColHeaderHeight(0); + dw_list.SetRowSelectorWidth(0); + + OnAttachEvent(); + SetAgent(); + Initail(); + return -1; + } +}; \ No newline at end of file -- Gitblit v1.9.3