From a4d2315ee4ca3f6177b4fb2526bed2feff3d89be Mon Sep 17 00:00:00 2001
From: lifan <2308045698@qq.com>
Date: 星期三, 22 十月 2025 16:52:58 +0800
Subject: [PATCH] update
---
jrj/project/business/BasicCode/QuickCode.cpp | 1295 +++++++++++++++++++++++++++++-----------------------------
1 files changed, 642 insertions(+), 653 deletions(-)
diff --git a/jrj/project/business/BasicCode/QuickCode.cpp b/jrj/project/business/BasicCode/QuickCode.cpp
index 456f4fe..1f8a5e1 100644
--- a/jrj/project/business/BasicCode/QuickCode.cpp
+++ b/jrj/project/business/BasicCode/QuickCode.cpp
@@ -1,676 +1,665 @@
-use"lang.vl"
-use "win.vl"
-use "dev:vm[xml.vm]"
-use "treeview.vm"
-use "dev:vm[xaserverarg.vm]"
-use "dev:vm[xaserver.vm]"
-use "dev:vm[xdwgrid.vm]"
-use "dev:vm[xutil.vm]"
-use "file.vl"
-use "list.vl"
-unit vbusiness.vpage
-[
- QuickCode is extend list;
- about QuickCode
- [
- field:
-
- method:
- [
- xdwgrid__ dw_list;
-
- string m_config;
- string m_agent;
- string m_id;
- string m_dbmap;
- string m_name;
- string strconfig;
- msxml::IXMLDOMDocument m_configDoc;
- int alert(string str)
+#include <wobject/xstring.hpp>
+#include <xcontrol/xtreeview.hpp>
+#include <xcontrol/xdwgrid.hpp>
+#include <wobject/xdouble.hpp>
+#include <xcontrol/xlayersheet.hpp>
+#include <wobject/xpage.hpp>
+
+#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+
+using xml = KXMLDOMDocument;
+class __declspec(dllexport) QuickCode : public xframe
+{
+public:
+ xdwgrid dw_list;
+
+ xstring m_config;
+ xstring m_agent;
+ xstring m_id;
+ xstring m_dbmap;
+ xstring m_name;
+ xstring strconfig;
+ KXMLDOMDocument m_configDoc;
+ xnode m_agentNode;
+public:
+ QuickCode(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
+public:
+ static QuickCode* CreateInstance(void* implPtr, void* hWnd)
+ {
+ QuickCode* pWin = new QuickCode(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();
+ //alert(m_configDoc.xml());
+ KXMLDOMElement agent = m_configDoc.selectSingleNode(L"Config/" + xfNodeAgentArea + L"[1]/*");
+ if (agent)
{
- //win__::MessageBox(this.GetHWND(),str,"提示:",0);
- TApp::alert(this,str);
+ xstring s = agent.xml();
+ m_agentNode = SetAgentNode(anode, s);
+ }
+ }
+ return 1;
+ }
+
+ int OnCmdDispatch(xstring comdid)
+ {
+
+ HCURSOR hCursor = xutil::SetCursorWait();
+ if (comdid == L"save") {
+ //type
+ xaserverarg args;
+
+ args.AddArg(L"id", m_id);
+ args.AddArg(L"name", m_name);
+ xml y;
+
+ //TDataSet::exec(m_config,L"savetype",args,y);
+ //url::post(L"QuickCode/pref/quickcode_type.save",args.GetString(),y);
+ //save
+
+ xml x;
+
+ xaserverarg arg;
+
+ dw_list.AcceptText();
+ dw_list.DwUpdateAllToEx(x);
+ KXMLDOMElement e = x.documentElement();
+ e.setAttribute(L"id", m_id);
+ //arg.AddArg(L"id",m_id);
+ arg.AddArg(L"content", e.xml());
+ arg.AddArg(L"dbmap", m_dbmap);
+ //trace(L"-->",m_id);
+ //trace(L"-->",m_dbmap);
+ //trace(e.xml());
+ /*if(TDataSet::exec(m_config,L"save",arg,x)!=1)
+ {
+ trace(L"error:"+x.xml());
+ alert(L"保存出错!");
+ return 0;
+ }*/
+ //trace(m_dbmap);
+ trace(x.xml());
+ if (xurl::get(L"QuickCode/pref/quickcode.save", arg.GetString(), x) != 1)
+ {
+ xstring error = x.text();
+ trace(error);
+ }
+ trace(x.xml());
+ if (x.selectSingleNode(L"error"))
+ {
+ alert(L"保存出错2!");
return 0;
}
- int SetAgent()
- {
- string xfNodeAgentArea = "agentarea";
- xnode__ anode = new xnode__;
- anode.setNativePointer(GetAgentNode(xfNodeAgentArea));
- string magent = m_agent;
- if (magent == ""){
- xml__ x = new xml__;
- x.setNativePointer(xml__::CreateInstance());
- TFile::get(m_config, x);
- var agent = x.GetXmlDoc().selectSingleNode("config/agentarea/*[1]");
- if(agent){
- magent = agent.xml;
- trace(magent);
- m_agent = magent;//agent.xml;
- SetAgentNodeContent (anode,magent);
- }
- }
- else
- SetAgentNodeContent (anode,m_agent);
- return 1;
+ dw_list.ResetUpdateStatus();
+ alert(L"保存成功!");
+ }
+ else if (comdid == L"add") {
+ dw_list.InsertRow(0);
+ int rows = dw_list.GetRowCount();
+ dw_list.SetRow(rows);
+ dw_list.SetItemString(rows, L"ToCurrencyCode", L"RMB");
+ dw_list.SetItemDisplayString(rows, L"ToCurrencyCode", L"人民币");
+ }
+ else if (comdid == L"insert") {
+ int row = dw_list.GetRow();
+ if (row<1 || row>dw_list.GetRowCount()) return 0;
+ dw_list.InsertRow(row);
+ dw_list.SetItemString(row, L"ToCurrencyCode", L"RMB");
+ dw_list.SetItemDisplayString(row, L"ToCurrencyCode", L"人民币");
+ }
+ else if (comdid == L"delet") {
+ /*int rows = dw_list.GetRowCount();
+ int row2 = dw_list.GetPrevSelectRow(rows);
+ while(row2 > 0){
+ dw_list.DeleteRow(row2);
+ row2 = dw_list.GetPrevSelectRow(row2 - 1);
}
-
- int OnCmdDispatch(string comdid)
+ dw_list.SelectRow(0, false);*/
+ int row2 = dw_list.GetRow();
+ if (row2<1 || row2>dw_list.GetRowCount()) return 0;
+ dw_list.DeleteRow(row2);
+ }
+ else if (comdid == L"import") {
+ if (m_id == L"FND_ExchangeRate")
{
+ int ll_delq = MessageBox(GetHWND(), L"确定要从老系统导入汇率数据吗?", L"提示", 1);
+ if (ll_delq != 1)
+ return 0;
+ xml xi;
- int hCursor = xutil__::SetCursorWait();
- if(comdid == "save"){
- //type
- xaserverarg__ args=new xaserverarg__;
- args.setNativePointer(args.CreateInstance());
- args.AddArg("id",m_id);
- args.AddArg("name", m_name);
- xml__ y=new xml__;
- y.setNativePointer(xml__::CreateInstance());
- //TDataSet::exec(m_config,"savetype",args,y);
- //url::post("QuickCode/pref/quickcode_type.save",args.GetString(),y);
- //save
-
- xml__ x=new xml__;
- x.setNativePointer(xml__::CreateInstance());
- xaserverarg__ arg=new xaserverarg__;
- arg.setNativePointer(arg.CreateInstance());
- dw_list.AcceptText();
- dw_list.DwUpdateAllToEx(x.GetXmlDoc());
- msxml::IXMLDOMElement e= x.GetXmlDoc().documentElement;
- e.SetAttribute("id", m_id);
- //arg.AddArg("id",m_id);
- arg.AddArg("content",e.xml);
- arg.AddArg("dbmap", m_dbmap);
- //trace("-->",m_id);
- //trace("-->",m_dbmap);
- //trace(e.xml);
- /*if(TDataSet::exec(m_config,"save",arg,x)!=1)
- {
- trace("error:"+x.GetXml());
- alert("保存出错!");
- return 0;
- }*/
- //trace(m_dbmap);
- trace(x.GetXml());
- if (url::get("QuickCode/pref/quickcode.save",arg.GetString(),x) != 1)
- {
- string error = x.GetXmlDoc().text;
- trace(error);
- }
- trace(x.GetXml());
- if(x.GetXmlDoc().selectSingleNode("error"))
- {
- alert("保存出错2!");
- return 0;
- }
- dw_list.ResetUpdateStatus();
- alert("保存成功!");
- }
- else if(comdid=="add"){
- dw_list.InsertRow(0);
- int rows = dw_list.GetRowCount();
- dw_list.SetRow(rows);
- dw_list.SetItemString(rows,"ToCurrencyCode","RMB");
- dw_list.SetItemDisplayString(rows,"ToCurrencyCode","人民币");
- }
- else if(comdid=="insert"){
- int row = dw_list.GetRow();
- if(row<1 || row>dw_list.GetRowCount()) return 0;
- dw_list.InsertRow(row);
- dw_list.SetItemString(row,"ToCurrencyCode","RMB");
- dw_list.SetItemDisplayString(row,"ToCurrencyCode","人民币");
- }
- else if(comdid == "delet"){
- /*int rows = dw_list.GetRowCount();
- int row2 = dw_list.GetPrevSelectRow(rows);
- while(row2 > 0){
- dw_list.DeleteRow(row2);
- row2 = dw_list.GetPrevSelectRow(row2 - 1);
- }
- dw_list.SelectRow(0, false);*/
- int row2 = dw_list.GetRow();
- if(row2<1 || row2>dw_list.GetRowCount()) return 0;
- dw_list.DeleteRow(row2);
- }
- else if(comdid == "import"){
- if(m_id=="FND_ExchangeRate")
- {
- int ll_delq = win__::MessageBox(this.GetHWND(), "确定要从老系统导入汇率数据吗?","提示",1);
- if (ll_delq != 1)
- return 0;
- xml__ xi=new xml__;
- xi.setNativePointer(xml__::CreateInstance());
- xaserverarg__ argi=new xaserverarg__;
- argi.setNativePointer(argi.CreateInstance());
- if (url::get("QuickCode/ExchangeRate/import",argi.GetString(),xi) != 1)
- {
- trace(xi.GetXmlDoc().text);
- return -1;
- }
- alert("导入成功!");
- dw_list.Redraw();
- }
-
- }
- xutil__::RestoreCursor(hCursor);
- return 0;
- }
- int OnXCommand(ref TXCommandEvent evt,int p)
- {
- return OnCmdDispatch(""+evt.pStrID);
- }
- int OnSetFocus(ref TNotifyEvent evt,int p){
- SetAgent();
- return 1;
- }
- int OnClicked(ref TNotifyEvent evt,int p)
- {
- ref DWNMHDR hdr = evt.pnmh;
- int row = hdr.row;
- int col=hdr.col + 1;
- string colname=dw_list.GetColumnName(col);
- trace(colname);
- xaserverarg__ arg = new xaserverarg__;
- arg.setNativePointer(arg.CreateInstance());
- string comdid;
- if(colname=="CategoryID")
- {
- openUrl("产品资料.vface/xpage/product/category/dialog", arg);
- comdid = arg.GetArgString("comdid");
- if(comdid=="ok")
- {
- string CategoryID = arg.GetArgString("CategoryID");
- string CName = arg.GetArgString("CName");
- dw_list.SetItemDisplayString(row,colname,CName);
- dw_list.SetItemString(row,colname,CategoryID);
- dw_list.Redraw();
- }
- }
- else if(colname=="MkOrgId")
- {
- openUrl("组织架构.vface/xpage/HrOrg/Chart", arg);
- comdid = arg.GetArgString("comdid");
- if(comdid=="xmOk")
- {
- string OrgName = arg.GetArgString("OrgName");
- string OrgId = arg.GetArgString("OrgId");
- dw_list.SetItemDisplayString(row,colname,OrgName);
- dw_list.SetItemString(row,colname,OrgId);
- dw_list.Redraw();
- }
- }
- else if(colname=="Cid")
- {
- openUrl("组织架构.vface/xpage/hremployee/select", arg);
- comdid = arg.GetArgString("comdid");
- if(comdid=="xmOk")
- {
- string sPersonID = arg.GetArgString("sPersonID");
- trace(sPersonID);
- string sPersonName = arg.GetArgString("sPersonName");
- dw_list.SetItemDisplayString(row,colname,sPersonName);
- dw_list.SetItemString(row,colname,sPersonID);
- dw_list.Redraw();
- }
- }
- return 1;
- }
- int OnDoubleClicked(ref TNotifyEvent evt,int p)
- {
- ref DWNMHDR hdr = evt.pnmh;
- int row = hdr.row;
- if(row<1 || row > dw_list.GetRowCount() ) return 0;
+ xaserverarg argi;
- xaserverarg__ arg = new xaserverarg__;
- arg.setNativePointer(arg.CreateInstance());
- //string str = hdr.data;
- string colname=hdr.colname;
- string str = dw_list.GetItemString(row, colname);
- arg.AddArg("value",str);
- openUrl("/sale/view/view.dlg/xpage/memo/edit", arg);
- string comdid = arg.GetArgString("comdid");
- if(comdid=="xmOK")
+ if (xurl::get(L"QuickCode/ExchangeRate/import", argi.GetString(), xi) != 1)
{
- string value = arg.GetArgString("value");
- dw_list.SetItemString(row,colname,value);
- dw_list.Redraw();
- }
-
- return 1;
- }
- int ItemOutput()
- {
- string d = xaserver__::GetCurrentDate();
- d = d.left(10) +"";
- dw_list.SaveAs(d);
- return 1;
- }
- int OnSelectAllRow()
- {
- int rows = this.dw_list.GetRowCount();
- if(rows < 1) return -1;
- this.dw_list.SelectRow(1, rows, true);
- this.dw_list.Redraw();
- return 1;
- }
- int OnRowCopy()
- {
- int rows = this.dw_list.GetRowCount();
- if(rows < 1) return -1;
- int cols = this.dw_list.GetColumnCount();
- string str = "";
- int row = this.dw_list.GetNextSelectRow(1);
- int i;
- while(row > 0)
- {
- string tmp1 = "";
- for(i=1; i<cols; i++)
- {
- int w = this.dw_list.GetColumnWidth(i);
- if(w < 5) continue;
- string tmp;
- if(this.dw_list.GetItemDisplayString(row, i + 1))
- tmp = this.dw_list.GetItemDisplayString(row, i + 1);
- else
- tmp = this.dw_list.GetItemString(row, i + 1);
- tmp1 += tmp + "\t";
- }
- str += tmp1 + "\r\n";
- row = this.dw_list.GetNextSelectRow(row + 1);
+ trace(xi.text());
+ return -1;
}
- this.dw_list.SetDataToClip(str);
- return 1;
- }
- int OnColCopy(string col)
- {
- int rows = this.dw_list.GetRowCount();
- if(rows < 1) return -1;
- string str = "";
- int row = this.dw_list.GetNextSelectRow(1);
- while(row > 0)
- {
- string tmp;
- if(this.dw_list.GetItemDisplayString(row, col))
- tmp = this.dw_list.GetItemDisplayString(row,col);
- else
- tmp = this.dw_list.GetItemString(row, col);
- str += tmp + "\r\n";
- row = this.dw_list.GetNextSelectRow(row + 1);
- }
- this.dw_list.SetDataToClip(str);
-
- return 1;
- }
- int OnRClick(ref TNotifyEvent evt,int p)
- {
- ref DWNMHDR hdr = evt.pnmh;
- int row = hdr.row;
-
- int m = win__::CreatePopupMenu();
- int MF_STRING = 0x00000000;
- int MF_DISABLED = 0x00000002;
- int TPM_RIGHTBUTTON = 0x0002;
- int TPM_RETURNCMD = 0x0100;
- int MF_CHECKED = 0x8;
- int MF_SEPARATOR = 0x0800;
- win__::AppendMenu(m,MF_STRING, 1, "复制行");
- win__::AppendMenu(m,MF_STRING, 101, "复制列");
- win__::AppendMenu(m,MF_SEPARATOR, -1, "");
- win__::AppendMenu(m,MF_STRING, 2, "全选");
- win__::AppendMenu(m,MF_SEPARATOR, -1, "");
- win__::AppendMenu(m,MF_STRING, 4, "导出到Excel");
- win__::AppendMenu(m,MF_SEPARATOR, -1, "");
- win__::AppendMenu(m,MF_STRING, 6, "显示列设置");
- xrect xr;
- xpoint pt;
- win__::GetCursorPos(pt);
- int ret=win__::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, this.GetHWND(), xr);
-
- //trace(ret);
- int hCursor = xutil__::SetCursorWait();
- if(ret == 1) {OnRowCopy();}
- else if(ret == 101) {
- string colname=hdr.colname;
- if(colname != "")
- OnColCopy(colname);
- }
- else if(ret == 2) {OnSelectAllRow();}
- else if(ret == 4) {ItemOutput();}
- else if(ret == 6) {}
- xutil__::RestoreCursor(hCursor);
-
- return 1;
- }
- int OnAttachEvent()
- {
- //获取焦点事件,用于重置工具条
- AttachEvent("WM_SETFOCUS",OnSetFocus);
- //绑定工具条点击事件
- AttachEvent("WM_XCOMMAND",OnXCommand);
- AttachEvent("dw_list","DWV_DOUBLECLICKED",OnDoubleClicked);//行双击
- AttachEvent("dw_list","DWV_ITEMBEINGEDIT",OnClicked);
- AttachEvent("dw_list","DWV_RCLICKED",OnRClick);//鼠标右键
- }
- int OnRetrieve()
- {
- xml__ x=new xml__;
- x.setNativePointer(xml__::CreateInstance());
- xaserverarg__ arg=new xaserverarg__;
- arg.setNativePointer(arg.CreateInstance());
- trace("asdasd");
-
- if(m_id.find("__",0) >0)
- {
- m_id = m_id.mid(0, m_id.find("__",0));
- arg.AddArg("id",m_id);
- //trace(m_id);
- /*if (TDataSet::exec(m_config, "query_remark", arg.GetString(),x) != 1)
- {
- trace(x.GetXmlDoc().text);
- return -1;
- }*/
- if (url::get("QuickCode/entity/list_remark",arg.GetString(),x) != 1)
- {
- trace(x.GetXmlDoc().text);
- return -1;
- }
- }
- else
- { trace("asdasd");
- arg.AddArg("id",m_id);
- arg.AddArg("querytxt","");
- /*if (TDataSet::exec(m_config, "query", arg.GetString(),x) != 1)
- {
- trace(x.GetXmlDoc().text);
- return -1;
- }*/
- if (url::get("QuickCode/entity/list",arg.GetString(),x) != 1)
- {
- trace(x.GetXmlDoc().text);
- return -1;
- }
- }
-
- dw_list.Retrieve(x);
+ alert(L"导入成功!");
dw_list.Redraw();
- return 1;
}
- string jxParam(string p, string n)
- {
- if(p != "")
- {
- p +="&";
- int i = 1;
- while (p.find("=",0)>0)
- {
- string name = p.mid(0, p.find("=",0));
- string value = p.mid(p.find("=",0) + 1, p.find("&",0) - p.find("=",0) - 1);
- if(name==n) return ""+value;
- i += 1;
- p = p.mid(p.find("&",0) + 1, p.length());
- }
- }
- return "";
- }
- int getURLParam()
- {
- if(GetParam())
- {
- xpage__ xp=new xpage__;
- xp.setNativePointer(this.GetXPage());
- string aurl = xp.GetWkUrl();
- xaserverarg__ arg;
- if(aurl && aurl.find("native=true",0)>0)
- {
- int p = this.GetParam();
- arg = new xaserverarg__;
- arg.setNativePointer(p);
- }
- else
- {
- arg = GetParam();
- }
- string config = arg.GetArgString("config");
- xml__ x = new xml__;
- x.setNativePointer(xml__::CreateInstance());
- if(config == "")
- {
- string configXml = arg.GetArgString("configxml");
- x.LoadXml(configXml);
- }
- else
- {
- getUrl(config, "", x);
- }
- m_configDoc = x.GetXmlDoc();
- }
-
- return 1;
- }
- int loaded()
- {
- getURLParam();
- msxml::IXMLDOMDocument ee=m_configDoc;
- string id=m_id;
- var n = ee.selectSingleNode("//list/dwview[@type='dwgrid'][@id='"+id+"']");
- string vface = m_configDoc.selectSingleNode("//vface[1]").text;
- string dwname = "";//e.selectsingleNode("@name").text;
- string tpl = "";//e.selectsingleNode("@url").text;
- string dbmap = "";
- if(n)
- {
- msxml::IXMLDOMElement e = n;
- //trace(e.xml);
- if(e.selectSingleNode("@name")) dwname = e.selectSingleNode("@name").text;
- if(e.selectSingleNode("@url")) tpl = e.selectSingleNode("@url").text;
- if(e.selectSingleNode("@dbmap")) dbmap = e.selectSingleNode("@dbmap").text;
- //trace(vface +"/"+ tpl);
- //trace(selectmode);
- }
+ }
+ 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 OnClicked(TEvent* evt, LPARAM p)
+ {
+ DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
+ int row = hdr.row;
+ int col = hdr.col + 1;
+ xstring colname = dw_list.GetColumnName(col);
+ trace(colname);
+ xaserverarg arg;
+
+ xstring comdid;
+ if (colname == L"CategoryID")
+ {
+ openUrl(L"产品资料.vface/xpage/product/category/dialog", arg);
+ comdid = arg.GetArgString(L"comdid");
+ if (comdid == L"ok")
+ {
+ xstring CategoryID = arg.GetArgString(L"CategoryID");
+ xstring CName = arg.GetArgString(L"CName");
+ dw_list.SetItemDisplayString(row, colname.c_str(), CName);
+ dw_list.SetItemString(row, colname.c_str(), CategoryID);
+ dw_list.Redraw();
+ }
+ }
+ else if (colname == L"MkOrgId")
+ {
+ openUrl(L"组织架构.vface/xpage/HrOrg/Chart", arg);
+ comdid = arg.GetArgString(L"comdid");
+ if (comdid == L"xmOk")
+ {
+ xstring OrgName = arg.GetArgString(L"OrgName");
+ xstring OrgId = arg.GetArgString(L"OrgId");
+ dw_list.SetItemDisplayString(row, colname.c_str(), OrgName);
+ dw_list.SetItemString(row, colname.c_str(), OrgId);
+ dw_list.Redraw();
+ }
+ }
+ else if (colname == L"Cid")
+ {
+ openUrl(L"组织架构.vface/xpage/hremployee/select", arg);
+ comdid = arg.GetArgString(L"comdid");
+ if (comdid == L"xmOk")
+ {
+ xstring sPersonID = arg.GetArgString(L"sPersonID");
+ trace(sPersonID);
+ xstring sPersonName = arg.GetArgString(L"sPersonName");
+ dw_list.SetItemDisplayString(row, colname.c_str(), sPersonName);
+ dw_list.SetItemString(row, colname.c_str(), sPersonID);
+ dw_list.Redraw();
+ }
+ }
+ return 1;
+ }
+ int OnDoubleClicked(TEvent* evt, LPARAM p)
+ {
+ DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
+ int row = hdr.row;
+ if (row<1 || row > dw_list.GetRowCount()) return 0;
+
+ xaserverarg arg;
+
+ //xstring str = hdr.data;
+ xstring colname = hdr.colname;
+ xstring str = dw_list.GetItemString(row, colname.c_str());
+ arg.AddArg(L"value", str);
+ openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg);
+ xstring comdid = arg.GetArgString(L"comdid");
+ if (comdid == L"xmOK")
+ {
+ xstring value = arg.GetArgString(L"value");
+ dw_list.SetItemString(row, colname.c_str(), value);
+ dw_list.Redraw();
+ }
+
+ return 1;
+ }
+ int ItemOutput()
+ {
+ xstring d = publiccode::GetCurrentDate();
+ d = d.left(10) + L"";
+ dw_list.SaveAs(d);
+ return 1;
+ }
+ int OnSelectAllRow()
+ {
+ int rows = dw_list.GetRowCount();
+ if (rows < 1) return -1;
+ dw_list.SelectRow(1, rows, true);
+ dw_list.Redraw();
+ return 1;
+ }
+ int OnRowCopy()
+ {
+ int rows = dw_list.GetRowCount();
+ if (rows < 1) return -1;
+ int cols = dw_list.GetColumnCount();
+ xstring str = L"";
+ int row = dw_list.GetNextSelectRow(1);
+ int i;
+ while (row > 0)
+ {
+ xstring tmp1 = L"";
+ for (i = 1; i < cols; i++)
+ {
+ int w = dw_list.GetColumnWidth(i);
+ if (w < 5) continue;
+ xstring tmp;
+ if (dw_list.GetItemDisplayString(row, i + 1))
+ tmp = dw_list.GetItemDisplayString(row, i + 1);
else
- {
- var m = ee.selectSingleNode("//list");
- msxml::IXMLDOMElement e1 = m;
- //trace(e.xml);
- if(e1.selectSingleNode("@name")) dwname = e1.selectSingleNode("@name").text;
- if(e1.selectSingleNode("@url")) tpl = e1.selectSingleNode("@url").text;
- if(e1.selectSingleNode("@dbmap")) dbmap = e1.selectSingleNode("@dbmap").text;
-
- }
- m_dbmap = dbmap;
- dw_list = new xdwgrid__;
- dw_list.setNativePointer(GetControl(dwname));
- dw_list.openUrl(vface +"/"+ tpl);
- //dw_list.SetSelectionMode(4);
-
+ tmp = dw_list.GetItemString(row, i + 1);
+ tmp1 += tmp + L"\t";
}
- int Onital()
- {
- //地区
- xml__ x1=new xml__;
- x1.setNativePointer(xml__::CreateInstance());
- xaserverarg__ arg1=new xaserverarg__;
- arg1.setNativePointer(arg1.CreateInstance());
- arg1.AddArg("id","地区");
- if (url::get("/sale/data/QuickCode/entity/list",arg1.GetString(),x1) != 1)
- {
- trace(x1.GetXmlDoc().text);
- return -1;
- }
+ str += tmp1 + L"\r\n";
+ row = dw_list.GetNextSelectRow(row + 1);
+ }
+ dw_list.SetDataToClip(str);
+ return 1;
+ }
+ int OnColCopy(xstring col)
+ {
+ int rows = dw_list.GetRowCount();
+ if (rows < 1) return -1;
+ xstring str = L"";
+ int row = dw_list.GetNextSelectRow(1);
+ while (row > 0)
+ {
+ xstring tmp;
+ if (dw_list.GetItemDisplayString(row, col.c_str()))
+ tmp = dw_list.GetItemDisplayString(row, col.c_str());
+ else
+ tmp = dw_list.GetItemString(row, col.c_str());
+ str += tmp + L"\r\n";
+ row = dw_list.GetNextSelectRow(row + 1);
+ }
+ dw_list.SetDataToClip(str);
- var list = x1.GetXmlDoc().selectNodes("root/item");
- int i;
- int s = list.length;
- if(s>0)
- {
- string str = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>";
- for(i=0;i<s;i++)
- {
- msxml::IXMLDOMElement xitem = list.item(i);
- string id="";
- if(xitem.selectSingleNode("Code"))
- id = xitem.selectSingleNode("Code").text;
- string name ="";
- if(xitem.selectSingleNode("Meaning"))
- name = xitem.selectSingleNode("Meaning").text;
- string tmp = "<row><显示列>"+name+"</显示列><数据列>"+id+"</数据列></row>";
- str += tmp;
- }
- str += "</data>'/></cellprop>";
+ return 1;
+ }
+ int OnRClick(TEvent* evt, LPARAM p)
+ {
+ DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
+ int row = hdr.row;
+ HMENU m = CreatePopupMenu();
+ int MF_STRING = 0x00000000;
+ int MF_DISABLED = 0x00000002;
+ int TPM_RIGHTBUTTON = 0x0002;
+ int TPM_RETURNCMD = 0x0100;
+ int MF_CHECKED = 0x8;
+ int MF_SEPARATOR = 0x0800;
+ AppendMenu(m, MF_STRING, 1, L"复制行");
+ AppendMenu(m, MF_STRING, 101, L"复制列");
+ AppendMenu(m, MF_SEPARATOR, -1, L"");
+ AppendMenu(m, MF_STRING, 2, L"全选");
+ AppendMenu(m, MF_SEPARATOR, -1, L"");
+ AppendMenu(m, MF_STRING, 4, L"导出到Excel");
+ AppendMenu(m, MF_SEPARATOR, -1, L"");
+ AppendMenu(m, MF_STRING, 6, L"显示列设置");
+ RECT xr;
+ xpoint pt;
+ GetCursorPos(pt);
+ int ret = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr);
- dw_list.SetColumnProps("AreaCode",str);
- }
- //币别
- xml__ x2=new xml__;
- x2.setNativePointer(xml__::CreateInstance());
- xaserverarg__ arg2=new xaserverarg__;
- arg2.setNativePointer(arg2.CreateInstance());
- arg2.AddArg("id","FND_Currency");
- if (url::get("/sale/data/QuickCode/entity/list",arg2.GetString(),x2) != 1)
- {
- trace(x2.GetXmlDoc().text);
- return -1;
- }
+ //trace(ret);
+ HCURSOR hCursor = xutil::SetCursorWait();
+ if (ret == 1) { OnRowCopy(); }
+ else if (ret == 101) {
+ xstring colname = hdr.colname;
+ if (colname != L"")
+ OnColCopy(colname);
+ }
+ else if (ret == 2) { OnSelectAllRow(); }
+ else if (ret == 4) { ItemOutput(); }
+ else if (ret == 6) {}
+ xutil::RestoreCursor(hCursor);
- var list1 = x2.GetXmlDoc().selectNodes("root/item");
- int j;
- int s1 = list1.length;
- if(s1>0)
- {
- string str1 = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>";
- for(j=0;j<s1;j++)
- {
- msxml::IXMLDOMElement xitem1 = list1.item(j);
- string id1="";
- if(xitem1.selectSingleNode("Code"))
- id1 = xitem1.selectSingleNode("Code").text;
- string name1 ="";
- if(xitem1.selectSingleNode("Name"))
- name1 = xitem1.selectSingleNode("Name").text;
- string tmp1 = "<row><显示列>"+name1+"</显示列><数据列>"+id1+"</数据列></row>";
- str1 += tmp1;
- }
- str1 += "</data>'/></cellprop>";
+ return 1;
+ }
+ int OnAttachEvent()
+ {
+ //获取焦点事件,用于重置工具条
+ AttachEvent(L"WM_SETFOCUS", (FEvent)&QuickCode::OnSetFocus);
+ //绑定工具条点击事件
+ AttachEvent(L"WM_XCOMMAND", (FEvent)&QuickCode::OnXCommand);
+ AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&QuickCode::OnDoubleClicked);//行双击
+ AttachEvent(L"dw_list", L"DWV_ITEMBEINGEDIT", (FEvent)&QuickCode::OnClicked);
+ AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&QuickCode::OnRClick);//鼠标右键
+ return 1;
+ }
+ int OnRetrieve()
+ {
+ xml x;
+ xaserverarg arg;
- dw_list.SetColumnProps("FromCurrencyCode",str1);
- }
- //国家
- xml__ x3=new xml__;
- x3.setNativePointer(xml__::CreateInstance());
- xaserverarg__ arg3=new xaserverarg__;
- arg3.setNativePointer(arg3.CreateInstance());
- arg3.AddArg("id","FND_Country");
- if (url::get("/sale/data/QuickCode/entity/list",arg3.GetString(),x3) != 1)
- {
- trace(x3.GetXmlDoc().text);
- return -1;
- }
+ trace(L"asdasd");
- var list2 = x3.GetXmlDoc().selectNodes("root/item");
- int k;
- int s2 = list2.length;
- if(s2>0)
- {
- string str2 = "<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>";
- for(k=0;k<s2;k++)
- {
- msxml::IXMLDOMElement xitem2 = list2.item(k);
- string id2="";
- if(xitem2.selectSingleNode("Code"))
- id2 = xitem2.selectSingleNode("Code").text;
- string name2 ="";
- if(xitem2.selectSingleNode("Name"))
- name2 = xitem2.selectSingleNode("Name").text;
- string tmp2 = "<row><显示列>"+name2+"</显示列><数据列>"+id2+"</数据列></row>";
- str2 += tmp2;
- }
- str2 += "</data>'/></cellprop>";
-
-
- dw_list.SetColumnProps("MkCountryId",str2);
- }
- dw_list.SetReadOnlyColumn("ToCurrencyCode");
- }
- int onload()
+ if (m_id.find(L"", 0) > 0)
+ {
+ m_id = m_id.mid(0, m_id.find(L"", 0));
+ arg.AddArg(L"id", m_id);
+ //trace(m_id);
+ /*if (TDataSet::exec(m_config, L"query_remark", arg.GetString(),x) != 1)
{
- m_config = "QuickCode.config";
- m_agent = "";
-
- //dw_list = new xdwgrid__;
- //dw_list.setNativePointer(GetControl("dw_list"));
- //dw_list.SetSelectionMode(4);
- //dw_list.AllowSort(false);
- if(this.GetParam())
- {
- xaserverarg__ arg = this.GetParam();
- string id = arg.GetArgString("id");
- if(id == "") return 0;
- m_id = id;
- loaded();
-
- /*string tpl = arg.GetArgString("tpl");
- if(tpl == "" && (m_id.find("__",0) >0))
- tpl = "QuickCode.tpl/QuickCode_Remark";
- else if(tpl == "" )
- tpl = "QuickCode.tpl/QuickCode";
- dw_list.SetDataObject(GetServerUrl(),"dev:sheet["+tpl+"]");
- string dbmap = arg.GetArgString("dbmap");
- if(dbmap == "" && (m_id.find("__",0) >0) )
- dbmap = "QuickCode_Remark.dbmap";
- else if(dbmap == "")
- dbmap ="QuickCode.dbmap";
- m_dbmap = dbmap;
- string name = arg.GetArgString("name");
- if(name == "")
- name = id;
- m_name = name;
- string title = arg.GetArgString("title");
- if(title != "")
- win__::SetWindowText(this.GetHWND(),title);*/
-
-
-
-
- /*
- param p = this.GetParam();
- string pa = ""+p;
- //string pa = "id=HrOrgType&title=客户类型";
- string id = jxParam(pa,"id");
- if(id == "") return 0;
- m_id = id;
- string tpl = jxParam(pa,"tpl");
- if(tpl == "" && (m_id.find("__",0) >0))
- tpl = "QuickCode.tpl/QuickCode_Remark";
- else if(tpl == "" )
- tpl = "QuickCode.tpl/QuickCode";
- dw_list.SetDataObject(GetServerUrl(),"dev:sheet["+tpl+"]");
- string dbmap = jxParam(pa,"dbmap");
- if(dbmap == "" && (m_id.find("__",0) >0) )
- dbmap = "QuickCode_Remark.dbmap";
- else if(dbmap == "")
- dbmap ="QuickCode.dbmap";
- m_dbmap = dbmap;
- //trace(m_dbmap);
-
- string name = jxParam(pa,"name");
- if(name == "")
- name = id;
- m_name = name;
- string title = jxParam(pa,"title");
- if(title != "")
- win__::SetWindowText(this.GetHWND(),title);*/
- OnRetrieve();
- }
-
- OnAttachEvent();
- SetAgent();
- Onital();
- return 1;
+ trace(x.text());
+ return -1;
+ }*/
+ if (xurl::get(L"QuickCode/entity/list_remark", arg.GetString(), x) != 1)
+ {
+ trace(x.text());
+ return -1;
}
- ]
- ]
-]
\ No newline at end of file
+ }
+ else
+ {
+ trace(L"asdasd");
+ arg.AddArg(L"id", m_id);
+ arg.AddArg(L"querytxt", L"");
+ /*if (TDataSet::exec(m_config, L"query", arg.GetString(),x) != 1)
+ {
+ trace(x.text());
+ return -1;
+ }*/
+ if (xurl::get(L"QuickCode/entity/list", arg.GetString(), x) != 1)
+ {
+ trace(x.text());
+ return -1;
+ }
+ }
+
+ dw_list.Retrieve(x);
+ dw_list.Redraw();
+ return 1;
+ }
+ xstring jxParam(xstring p, xstring n)
+ {
+ if (p != L"")
+ {
+ p += L"&";
+ int i = 1;
+ while (p.find(L"=", 0) > 0)
+ {
+ xstring name = p.mid(0, p.find(L"=", 0));
+ xstring value = p.mid(p.find(L"=", 0) + 1, p.find(L"&", 0) - p.find(L"=", 0) - 1);
+ if (name == n) return L"" + value;
+ i += 1;
+ p = p.mid(p.find(L"&", 0) + 1, p.length());
+ }
+ }
+ return L"";
+ }
+ int getURLParam()
+ {
+ if (GetWinParam())
+ {
+ xpage xp = GetXPage();
+ xstring aurl = xp.GetWkUrl();
+ xaserverarg arg = GetArg();
+ xstring config = arg.GetArgString(L"config");
+ xml x;
+
+ if (config == L"")
+ {
+ xstring configXml = arg.GetArgString(L"configxml");
+ x.loadXML(configXml);
+ }
+ else
+ {
+ getUrl(config, L"", x);
+ }
+ m_configDoc = x;
+
+ }
+
+ return 1;
+ }
+ int loaded()
+ {
+
+ getURLParam();
+ KXMLDOMDocument ee = m_configDoc;
+ xstring id = m_id;
+ auto n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']");
+ xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
+ xstring dwname = L"";//e.selectsingleNode(L"@name").text();
+ xstring tpl = L"";//e.selectsingleNode(L"@url").text();
+ xstring dbmap = L"";
+ if (n)
+ {
+ KXMLDOMElement e = n;
+ //trace(e.xml());
+ if (e.selectSingleNode(L"@name")) dwname = e.selectSingleNode(L"@name").text();
+ if (e.selectSingleNode(L"@url")) tpl = e.selectSingleNode(L"@url").text();
+ if (e.selectSingleNode(L"@dbmap")) dbmap = e.selectSingleNode(L"@dbmap").text();
+ //trace(vface +L"/"+ tpl);
+ //trace(selectmode);
+ }
+ else
+ {
+ auto m = ee.selectSingleNode(L"//list");
+ KXMLDOMElement e1 = m;
+ //trace(e.xml());
+ if (e1.selectSingleNode(L"@name")) dwname = e1.selectSingleNode(L"@name").text();
+ if (e1.selectSingleNode(L"@url")) tpl = e1.selectSingleNode(L"@url").text();
+ if (e1.selectSingleNode(L"@dbmap")) dbmap = e1.selectSingleNode(L"@dbmap").text();
+
+ }
+ m_dbmap = dbmap;
+ dw_list = GetControl(dwname);
+ dw_list.openUrl(vface + L"/" + tpl);
+ //dw_list.SetSelectionMode(4);
+ return 1;
+ }
+ int Onital()
+ {
+ //地区
+ xml x1;
+
+ xaserverarg arg1;
+
+ arg1.AddArg(L"id", L"地区");
+ if (xurl::get(L"/sale/data/QuickCode/entity/list", arg1.GetString(), x1) != 1)
+ {
+ trace(x1.text());
+ return -1;
+ }
+
+ auto list = x1.selectNodes(L"root/item");
+ int i;
+ int s = list.length();
+ if (s > 0)
+ {
+ xstring str = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>";
+ for (i = 0; i < s; i++)
+ {
+ KXMLDOMElement xitem = list.item(i);
+ xstring id = L"";
+ if (xitem.selectSingleNode(L"Code"))
+ id = xitem.selectSingleNode(L"Code").text();
+ xstring name = L"";
+ if (xitem.selectSingleNode(L"Meaning"))
+ name = xitem.selectSingleNode(L"Meaning").text();
+ xstring tmp = L"<row><显示列>" + name + L"</显示列><数据列>" + id + L"</数据列></row>";
+ str += tmp;
+ }
+ str += L"</data>'/></cellprop>";
+
+
+ dw_list.SetColumnProps(L"AreaCode", str);
+ }
+ //币别
+ xml x2;
+
+ xaserverarg arg2;
+
+ arg2.AddArg(L"id", L"FND_Currency");
+ if (xurl::get(L"/sale/data/QuickCode/entity/list", arg2.GetString(), x2) != 1)
+ {
+ trace(x2.text());
+ return -1;
+ }
+
+ auto list1 = x2.selectNodes(L"root/item");
+ int j;
+ int s1 = list1.length();
+ if (s1 > 0)
+ {
+ xstring str1 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>";
+ for (j = 0; j < s1; j++)
+ {
+ KXMLDOMElement xitem1 = list1.item(j);
+ xstring id1 = L"";
+ if (xitem1.selectSingleNode(L"Code"))
+ id1 = xitem1.selectSingleNode(L"Code").text();
+ xstring name1 = L"";
+ if (xitem1.selectSingleNode(L"Name"))
+ name1 = xitem1.selectSingleNode(L"Name").text();
+ xstring tmp1 = L"<row><显示列>" + name1 + L"</显示列><数据列>" + id1 + L"</数据列></row>";
+ str1 += tmp1;
+ }
+ str1 += L"</data>'/></cellprop>";
+
+
+ dw_list.SetColumnProps(L"FromCurrencyCode", str1);
+ }
+ //国家
+ xml x3;
+
+ xaserverarg arg3;
+
+ arg3.AddArg(L"id", L"FND_Country");
+ if (xurl::get(L"/sale/data/QuickCode/entity/list", arg3.GetString(), x3) != 1)
+ {
+ trace(x3.text());
+ return -1;
+ }
+
+ auto list2 = x3.selectNodes(L"root/item");
+ int k;
+ int s2 = list2.length();
+ if (s2 > 0)
+ {
+ xstring str2 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='<data>";
+ for (k = 0; k < s2; k++)
+ {
+ KXMLDOMElement xitem2 = list2.item(k);
+ xstring id2 = L"";
+ if (xitem2.selectSingleNode(L"Code"))
+ id2 = xitem2.selectSingleNode(L"Code").text();
+ xstring name2 = L"";
+ if (xitem2.selectSingleNode(L"Name"))
+ name2 = xitem2.selectSingleNode(L"Name").text();
+ xstring tmp2 = L"<row><显示列>" + name2 + L"</显示列><数据列>" + id2 + L"</数据列></row>";
+ str2 += tmp2;
+ }
+ str2 += L"</data>'/></cellprop>";
+
+
+ dw_list.SetColumnProps(L"MkCountryId", str2);
+ }
+ dw_list.SetReadOnlyColumn(L"ToCurrencyCode");
+ }
+ int onload()
+ {
+
+ SetArg();
+ m_config = L"QuickCode.config";
+ m_agent = L"";
+
+ //dw_list = new xdwgrid;
+ //dw_list.setNativePointer(GetControl(L"dw_list"));
+ //dw_list.SetSelectionMode(4);
+ //dw_list.AllowSort(false);
+ if (GetWinParam())
+ {
+ xaserverarg arg = GetArg();
+ xstring id = arg.GetArgString(L"id");
+ if (id == L"") return 0;
+ m_id = id;
+ loaded();
+
+ /*xstring tpl = arg.GetArgString(L"tpl");
+ if(tpl == L"" && (m_id.find(L"",0) >0))
+ tpl = L"QuickCode.tpl/QuickCode_Remark";
+ else if(tpl == L"" )
+ tpl = L"QuickCode.tpl/QuickCode";
+ dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]");
+ xstring dbmap = arg.GetArgString(L"dbmap");
+ if(dbmap == L"" && (m_id.find(L"",0) >0) )
+ dbmap = L"QuickCode_Remark.dbmap";
+ else if(dbmap == L"")
+ dbmap =L"QuickCode.dbmap";
+ m_dbmap = dbmap;
+ xstring name = arg.GetArgString(L"name");
+ if(name == L"")
+ name = id;
+ m_name = name;
+ xstring title = arg.GetArgString(L"title");
+ if(title != L"")
+ win::SetWindowText(GetHWND(),title);*/
+
+
+
+
+ /*
+ param p = GetParam();
+ xstring pa = L""+p;
+ //xstring pa = L"id=HrOrgType&title=客户类型";
+ xstring id = jxParam(pa,L"id");
+ if(id == L"") return 0;
+ m_id = id;
+ xstring tpl = jxParam(pa,L"tpl");
+ if(tpl == L"" && (m_id.find(L"",0) >0))
+ tpl = L"QuickCode.tpl/QuickCode_Remark";
+ else if(tpl == L"" )
+ tpl = L"QuickCode.tpl/QuickCode";
+ dw_list.SetDataObject(GetServerUrl(),L"dev:sheet["+tpl+L"]");
+ xstring dbmap = jxParam(pa,L"dbmap");
+ if(dbmap == L"" && (m_id.find(L"",0) >0) )
+ dbmap = L"QuickCode_Remark.dbmap";
+ else if(dbmap == L"")
+ dbmap =L"QuickCode.dbmap";
+ m_dbmap = dbmap;
+ //trace(m_dbmap);
+
+ xstring name = jxParam(pa,L"name");
+ if(name == L"")
+ name = id;
+ m_name = name;
+ xstring title = jxParam(pa,L"title");
+ if(title != L"")
+ win::SetWindowText(GetHWND(),title);*/
+ OnRetrieve();
+ }
+
+ OnAttachEvent();
+ SetAgent();
+ Onital();
+ return 1;
+ }
+};
\ No newline at end of file
--
Gitblit v1.9.3