From c73702d600ef2d0843ec7e3ace65f8c63c6905c2 Mon Sep 17 00:00:00 2001 From: LiFan <2308045698@qq.com> Date: 星期二, 16 七月 2024 15:21:53 +0800 Subject: [PATCH] update --- jrj/project/business/BasicCode/ColorCardNew.cpp | 297 +++++++++++++++++++++++++++++++---------------------------- 1 files changed, 155 insertions(+), 142 deletions(-) diff --git a/jrj/project/business/BasicCode/ColorCardNew.cpp b/jrj/project/business/BasicCode/ColorCardNew.cpp index f73a6c6..d749027 100644 --- a/jrj/project/business/BasicCode/ColorCardNew.cpp +++ b/jrj/project/business/BasicCode/ColorCardNew.cpp @@ -1,65 +1,78 @@ -/*use "list.vd" -use "xtreeview.vd" -use "publiccode.vd"*/ -use "xcontrol.vframe.vbusiness.vd" -use "xbase.vframe.vbusiness.vd" -unit trade -[ -class ColorCardNew : public listwin +#include <wobject/xstring.hpp> +#include <xcontrol/xtreeview.hpp> +#include <xcontrol/xdwgrid.hpp> +#include <wobject/xdouble.hpp> +#include <xcontrol/xlayersheet.hpp> +#include <xcontrol/xdatetimepick.hpp> + + +#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" +#include "viewobject/view.base.hpp" + +using xml = KXMLDOMDocument; +class __declspec(dllexport) ColorCardNew : public listwin { +public: xdwgrid dw_list; xdwgrid dw_detail; bool ismodify; xnode m_agentNode; - string m_agentCond; - + xstring m_agentCond; +public: + ColorCardNew(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} +public: + static ColorCardNew* CreateInstance(void* implPtr, void* hWnd) + { + ColorCardNew* pWin = new ColorCardNew(implPtr, (HWND)hWnd); + return pWin; + } int SetAgent() { - string xfNodeAgentArea = "agentarea"; + xstring xfNodeAgentArea = L"agentarea"; xnode anode = GetAgentNode(xfNodeAgentArea); - msxml::IXMLDOMElement xframeElement = GetElement(); - msxml::IXMLDOMNode agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); + KXMLDOMElement xframeElement = GetElement(); + KXMLDOMNode agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); if(agent) - SetAgentNodeContent(anode, agent.xml); + SetAgentNode(anode, agent.xml()); return 1; } //焦点激活处理函数 - int OnSetFocus(ref TEvent evt,int param) + int OnSetFocus(TEvent* evt, LPARAM param) { SetAgent(); //重置工具条 return 1; } - int ProcessFlowAction(string guid,string comdid) + int ProcessFlowAction(xstring guid,xstring comdid) { //int pr = pr1; - //string action = comdid;//.mid(comdid.find("action:",0)+7,9999); - /*if(action == "bill.delete" || action == "bill.deleteEx") + //xstring action = comdid;//.mid(comdid.find(L"action:",0)+7,9999); + /*if(action == L"bill.delete" || action == L"bill.deleteEx") { - if (MessageBox(GetHWND(),"是否确定删除记录!","提示1",1) == 2) + if (MessageBox(GetHWND(),L"是否确定删除记录!",L"提示1",1) == 2) return 1; }*/ - xaserverarg arg0 = new xaserverarg ; + xaserverarg arg0 ; arg0.setNativePointer(arg0.CreateInstance()); - //arg0.AddArg("Action", action,"xs:string"); - arg0.AddArg("EntityName", "ColorCard","xs:string"); - arg0.AddArg("EntityIDName", "ColorCardID","xs:string"); - arg0.AddArg("EntityID", guid,"xs:string"); - arg0.AddArg("FunctionCode", comdid,"xs:string"); + //arg0.AddArg(L"Action", action,L"xs:xstring"); + arg0.AddArg(L"EntityName", L"ColorCard",L"xs:xstring"); + arg0.AddArg(L"EntityIDName", L"ColorCardID",L"xs:xstring"); + arg0.AddArg(L"EntityID", guid,L"xs:xstring"); + arg0.AddArg(L"FunctionCode", comdid,L"xs:xstring"); xml x = new xml; - x.setNativePointer(xml::CreateInstance()); + - if(url::get("/sale/data/Role.config/sys/sql/action", arg0.GetString(), x) != 1) + if(xurl::get(L"/sale/data/Role.config/sys/sql/action", arg0.GetString(), x) != 1) { //ismodify=false; //dw_list.SetReadOnly(ismodify); return -1; } - string kk=x.GetXml(); - if(kk.find("<root/>",0)>=0) + xstring kk=x.xml(); + if(kk.find(L"<root/>",0)>=0) { //ismodify=true; //dw_list.SetReadOnly(ismodify); @@ -68,7 +81,7 @@ return -1; } - int ModifyProcessAction(string guid,string comdid) + int ModifyProcessAction(xstring guid,xstring comdid) { if(ProcessFlowAction(guid,comdid)>0) { @@ -83,7 +96,7 @@ return -1; } } - int DeleteProcessAction(string guid,string comdid) + int DeleteProcessAction(xstring guid,xstring comdid) { if(ProcessFlowAction(guid,comdid)>0) { @@ -96,17 +109,17 @@ } //根据ColorCardID加载Detail数据 - int OnRetrieveDetail(string ColorCardID) + int OnRetrieveDetail(xstring ColorCardID) { - xml x=new xml; - x.setNativePointer(xml::CreateInstance()); - xaserverarg arg=new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); + xml x; + + xaserverarg arg; + - arg.AddArg("ColorCardID",ColorCardID); - if (url::get("ColorCard/entity/list1",arg.GetString(),x) != 1) + arg.AddArg(L"ColorCardID",ColorCardID); + if (xurl::get(L"ColorCard/entity/list1",arg.GetString(),x) != 1) { - trace(x.GetXmlDoc().text); + trace(x.text()); return -1; } dw_detail.Retrieve(x); @@ -119,29 +132,29 @@ { if (dw_list) { - string colorCardCName; - string colorCardName; - string orgID; + xstring colorCardCName; + xstring colorCardName; + xstring orgID; int i; int row = dw_list.GetRowCount(); for (i=1; i<=row;i++) { - colorCardCName=dw_list.GetItemString(i,"ColorCardCName",0)+""; - colorCardName=dw_list.GetItemString(i,"ColorCardName",0)+""; - orgID=dw_list.GetItemString(i,"OrgID",0)+""; - if (colorCardCName=="" || !colorCardCName) + colorCardCName=dw_list.GetItemString(i,L"ColorCardCName")+L""; + colorCardName=dw_list.GetItemString(i,L"ColorCardName")+L""; + orgID=dw_list.GetItemString(i,L"OrgID")+L""; + if (colorCardCName==L"" || !colorCardCName) { - alert("第"+i.toString()+"行色卡名称中文为空"); + alert(L"第"+xstring(i)+L"行色卡名称中文为空"); return -1; } - if (colorCardName=="" || !colorCardName) + if (colorCardName==L"" || !colorCardName) { - alert("第"+i.toString()+"行色卡名称为空"); + alert(L"第"+ xstring(i) +L"行色卡名称为空"); return -1; } - if (orgID=="" || !orgID) + if (orgID==L"" || !orgID) { - alert("第"+i.toString()+"行关联组织为空"); + alert(L"第"+ xstring(i) +L"行关联组织为空"); return -1; } } @@ -160,22 +173,22 @@ if (rec == -1) return -1; xml x= new xml; - x.setNativePointer(xml::CreateInstance()); - dw_list.DwUpdateAllToEx(x.GetXmlDoc()); - xaserverarg arg = new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); - msxml::IXMLDOMElement e= x.GetXmlDoc().selectSingleNode("root"); - arg.AddArg("content",e.xml); - arg.AddArg("dbmap","ColorCard.dbmap"); - if (url::get("ColorCard/pref/colorcard.save",arg.GetString(),x) != 1) + + dw_list.DwUpdateAllToEx(x); + xaserverarg arg; + + KXMLDOMElement e= x.selectSingleNode(L"root"); + arg.AddArg(L"content",e.xml()); + arg.AddArg(L"dbmap",L"ColorCard.dbmap"); + if (xurl::get(L"ColorCard/pref/colorcard.save",arg.GetString(),x) != 1) { - trace("error:"+x.GetXml()); - alert("保存失败!"); + trace(L"error:"+(xstring)x.xml()); + alert(L"保存失败!"); return 0; } else { - alert("保存成功!"); + alert(L"保存成功!"); dw_list.ResetUpdateStatus(); } dw_list.Redraw(); @@ -187,9 +200,10 @@ dw_list.AcceptText(); int nrow=dw_list.InsertRow(0); dw_list.ShowRowTo(nrow); - string tempguid = publiccode::GetGuid(); - dw_list.SetItemString(nrow,"ColorCardID",tempguid); + xstring tempguid = publiccode::GetGuid(); + dw_list.SetItemString(nrow,L"ColorCardID",tempguid); OnRetrieveDetail(tempguid); + return 1; } //插入 @@ -199,8 +213,8 @@ int row = dw_list.GetRow(); if(row<1) return 0; int nrow=dw_list.InsertRow(row); - string tempguid = publiccode::GetGuid(); - dw_list.SetItemString(nrow,"ColorCardID",tempguid); + xstring tempguid = publiccode::GetGuid(); + dw_list.SetItemString(nrow,L"ColorCardID",tempguid); OnRetrieveDetail(tempguid); } @@ -210,29 +224,29 @@ dw_list.AcceptText(); int row = dw_list.GetRow(); if(row<1) return 0; - string id=dw_list.GetItemString(row,"ColorCardID"); - if(DeleteProcessAction(id,"DeleteColorCard")<0) + xstring id=dw_list.GetItemString(row,L"ColorCardID"); + if(DeleteProcessAction(id,L"DeleteColorCard")<0) { - alert("您没有权限删除该数据"); + alert(L"您没有权限删除该数据"); return -1; } - if(id !="") + if(id !=L"") { - xml x=new xml; - x.setNativePointer(xml::CreateInstance()); - xaserverarg arg = new xaserverarg; + xml x; + + xaserverarg arg; arg.setNativePointer(arg.CreateInstance()); - arg.AddArg("ColorCardID", id); - if(url::get("ColorCard/pref/beforedelete",arg.GetString(),x)!=1) + arg.AddArg(L"ColorCardID", id); + if(xurl::get(L"ColorCard/pref/beforedelete",arg.GetString(),x)!=1) { - trace("error:"+x.GetXml()); - alert("删除出错!"); + trace(L"error:"+(xstring)x.xml()); + alert(L"删除出错!"); return 0; } - msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement; - if(e.selectSingleNode("error")) + KXMLDOMElement e= x.documentElement(); + if(e.selectSingleNode(L"error")) { - alert(e.selectSingleNode("error").text); + alert(e.selectSingleNode(L"error").text()); return 0; } } @@ -243,9 +257,9 @@ { dw_detail.AcceptText(); int nrow=dw_detail.InsertRow(0); - string tempguid = publiccode::GetGuid(); - dw_detail.SetItemString(dw_detail.GetRow(),"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),"ColorCardID")); - dw_detail.SetItemString(dw_detail.GetRow(),"ColorID",tempguid); + xstring tempguid = publiccode::GetGuid(); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),L"ColorCardID")); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorID",tempguid); //OnRetrieveDetail(tempguid); dw_detail.ShowRowTo(nrow); @@ -258,9 +272,9 @@ int row = dw_detail.GetRow(); if(row<1) return 0; int nrow=dw_detail.InsertRow(row); - string tempguid = publiccode::GetGuid(); - dw_detail.SetItemString(dw_detail.GetRow(),"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),"ColorCardID")); - dw_detail.SetItemString(dw_detail.GetRow(),"ColorID",tempguid); + xstring tempguid = publiccode::GetGuid(); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorCardID",dw_list.GetItemString(dw_list.GetRow(),L"ColorCardID")); + dw_detail.SetItemString(dw_detail.GetRow(),L"ColorID",tempguid); return 1; } @@ -271,73 +285,73 @@ int rowz = dw_list.GetRow(); if(row<1)return 0; dw_detail.DeleteRow(row); - msxml::IXMLDOMElement ez= this.dw_list.GetRowElement(rowz); - xml xz=new xml; - xz.setNativePointer(xml::CreateInstance()); - dw_detail.DwUpdateAllToEx(xz.GetXmlDoc()); - if (ez.selectSingleNode("root")) - ez.removeChild(ez.selectSingleNode("root")); - ez.appendChild(xz.GetXmlDoc().documentElement); + KXMLDOMElement ez= dw_list.GetRowElement(rowz); + xml xz; + dw_detail.DwUpdateAllToEx(xz); + if (ez.selectSingleNode(L"root")) + ez.removeChild(ez.selectSingleNode(L"root")); + ez.appendChild(xz.documentElement()); return 1; } //命令发布函数 - int OnCmdDispatch(string comdid) + int OnCmdDispatch(xstring comdid) { - if(comdid=="save") OnSave(); - else if(comdid=="add") OnAdd(); - else if(comdid=="insert") OnInsert(); - else if(comdid=="del") OnDelete(); - else if(comdid=="addrowDetail") OnAddRowDetail(); - else if(comdid=="insertrowDetail") OnInsertRowDetail(); - else if(comdid=="deleterowDetail") OnDelRowDetail(); + if(comdid==L"save") OnSave(); + else if(comdid==L"add") OnAdd(); + else if(comdid==L"insert") OnInsert(); + else if(comdid==L"del") OnDelete(); + else if(comdid==L"addrowDetail") OnAddRowDetail(); + else if(comdid==L"insertrowDetail") OnInsertRowDetail(); + else if(comdid==L"deleterowDetail") OnDelRowDetail(); return 1; } //命令处理事件 - int OnXCommand(ref TXCommandEvent evt,int param) + int OnXCommand(TEvent* evt, LPARAM param) { - return OnCmdDispatch(evt.pStrID); + return OnCmdDispatch(evt->xcommand.pStrID); } //行改变事件 - int OnListRowChanged(ref TNotifyEvent evt,int p) + int OnListRowChanged(TEvent* evt, int p) { - dw_detail.AcceptText(); - ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); + dw_detail.AcceptText(); + + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; int row = hdr.row; dw_list.Redraw(); - msxml::IXMLDOMElement e = dw_list.GetRowElement(row); - string ColorCardID = e.selectSingleNode("ColorCardID").text; + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring ColorCardID = e.selectSingleNode(L"ColorCardID").text(); OnRetrieveDetail(ColorCardID); return 1; } - int OnDetailChanged(ref TNotifyEvent evt,int p) + int OnDetailChanged(TEvent* evt, int p) { int row = dw_list.GetRow(); - msxml::IXMLDOMElement e= this.dw_list.GetRowElement(row); - xml x=new xml; - x.setNativePointer(xml::CreateInstance()); - dw_detail.DwUpdateAllToEx(x.GetXmlDoc()); - if (e.selectSingleNode("root")) - e.removeChild(e.selectSingleNode("root")); - e.appendChild(x.GetXmlDoc().documentElement); + KXMLDOMElement e= dw_list.GetRowElement(row); + xml x; + + dw_detail.DwUpdateAllToEx(x); + if (e.selectSingleNode(L"root")) + e.removeChild(e.selectSingleNode(L"root")); + e.appendChild(x.documentElement()); return 0; } - int OnDwListClick(ref TNotifyEvent evt,int p) + int OnDwListClick(TEvent* evt, int p) { - ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); + DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; int row = hdr.row; dw_list.Redraw(); - msxml::IXMLDOMElement e = dw_list.GetRowElement(row); - string ColorCardID = e.selectSingleNode("ColorCardID").text; - ModifyProcessAction(ColorCardID,"ModifyColorCard"); + KXMLDOMElement e = dw_list.GetRowElement(row); + xstring ColorCardID = e.selectSingleNode(L"ColorCardID").text(); + ModifyProcessAction(ColorCardID,L"ModifyColorCard"); return 1; } @@ -345,28 +359,28 @@ int OnAttachEvent() { //绑定工具条点击事件 - AttachEvent("WM_XCOMMAND",OnXCommand); + AttachEvent(L"WM_XCOMMAND", (FEvent)&ColorCardNew::OnXCommand); //获取焦点事件,用于重置工具条 - AttachEvent("WM_SETFOCUS",OnSetFocus); + AttachEvent(L"WM_SETFOCUS", (FEvent)&ColorCardNew::OnSetFocus); //行改变事件 - AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnListRowChanged); - AttachEvent("dw_detail","DWV_ITEMCHANGED",OnDetailChanged); - //AttachEvent("dw_list","DWV_ITEMCHANGED",OnDetailChanged); - AttachEvent("dw_list","DWV_CLICKED",OnDwListClick); + AttachEvent(L"dw_list",L"DWV_ROWFOCUSCHANGED", (FEvent)&ColorCardNew::OnListRowChanged); + AttachEvent(L"dw_detail",L"DWV_ITEMCHANGED", (FEvent)&ColorCardNew::OnDetailChanged); + //AttachEvent(L"dw_list",L"DWV_ITEMCHANGED",OnDetailChanged); + AttachEvent(L"dw_list",L"DWV_CLICKED", (FEvent)&ColorCardNew::OnDwListClick); return 1; } - int OnRetrieve(string str) + int OnRetrieve(xstring str) { - xml x=new xml; - x.setNativePointer(xml::CreateInstance()); - xaserverarg arg=new xaserverarg; - arg.setNativePointer(arg.CreateInstance()); - arg.AddArg("id",str); - if (url::get("ColorCard/entity/list",arg.GetString(),x) != 1) + xml x; + + xaserverarg arg; + + arg.AddArg(L"id",str); + if (xurl::get(L"ColorCard/entity/list",arg.GetString(),x) != 1) { - trace(x.GetXmlDoc().text); + trace(x.text()); return -1; } //doc=x; @@ -388,16 +402,15 @@ int onload() { - dw_list = GetControl("dw_list"); - dw_list.openUrl("产品设置.vface/template/ColorCard/list"); + dw_list = GetControl(L"dw_list"); + dw_list.openUrl(L"产品设置.vface/template/ColorCard/list"); - dw_detail = GetControl("dw_detail"); - dw_detail.openUrl("产品设置.vface/template/ColorCard/listex"); + dw_detail = GetControl(L"dw_detail"); + dw_detail.openUrl(L"产品设置.vface/template/ColorCard/listex"); OnInitial(); - OnRetrieve("FND_ColorCard"); + OnRetrieve(L"FND_ColorCard"); return 1; } -}; -] \ No newline at end of file +}; \ No newline at end of file -- Gitblit v1.9.3