From b4fef6e662f0c08c3751bd0c7481efcb267b621f Mon Sep 17 00:00:00 2001
From: lifan <2308045698@qq.com>
Date: 星期四, 05 十一月 2026 18:00:05 +0800
Subject: [PATCH] update

---
 jrj/project/business/GDN3.list.cpp                 |   32 +++
 jrj/project/business/GDN/maint.Document.GDN.v3.cpp |  452 ++++++++++++++++++++++++++++++++++++++++++++++++++
 jrj/ext-jrj/ext-jrj.vcxproj                        |    1 
 jrj/ext-jrj/ext-jrj.vcxproj.filters                |    3 
 4 files changed, 488 insertions(+), 0 deletions(-)

diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj
index 1cce6c2..bfadbb9 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj
+++ b/jrj/ext-jrj/ext-jrj.vcxproj
@@ -725,6 +725,7 @@
     </ClCompile>
     <ClCompile Include="..\project\business\GDN\list.SOTrace3.cpp" />
     <ClCompile Include="..\project\business\GDN\listex.GDN3.cpp" />
+    <ClCompile Include="..\project\business\GDN\maint.Document.GDN.v3.cpp" />
     <ClCompile Include="..\project\business\GDN\maintex.gdn3.cpp" />
     <ClCompile Include="..\project\business\GDN\Merge.GDN.cpp" />
     <ClCompile Include="..\project\business\GDN\po.paper.cpp" />
diff --git a/jrj/ext-jrj/ext-jrj.vcxproj.filters b/jrj/ext-jrj/ext-jrj.vcxproj.filters
index 5881933..838c925 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj.filters
+++ b/jrj/ext-jrj/ext-jrj.vcxproj.filters
@@ -1673,6 +1673,9 @@
     <ClCompile Include="..\project\business\Expense\DayExchangeRate.cpp">
       <Filter>project\business\Expense</Filter>
     </ClCompile>
+    <ClCompile Include="..\project\business\GDN\maint.Document.GDN.v3.cpp">
+      <Filter>project\business\GDN</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <None Include="ext-jrj.def">
diff --git a/jrj/project/business/GDN/maint.Document.GDN.v3.cpp b/jrj/project/business/GDN/maint.Document.GDN.v3.cpp
new file mode 100644
index 0000000..9ef738f
--- /dev/null
+++ b/jrj/project/business/GDN/maint.Document.GDN.v3.cpp
@@ -0,0 +1,452 @@
+#include <wobject/xstring.hpp>
+#include <xcontrol/xtreeview.hpp>
+#include <xcontrol/xlistview.hpp>
+#include <xcontrol/xdwgrid.hpp>
+
+#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+
+using xml = KXMLDOMDocument;
+
+	class  __declspec(dllexport) DocumentGDN : public xframe
+	{
+	public:
+		DocumentGDN(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
+	public:
+		static DocumentGDN* CreateInstance(void* implPtr, void* hWnd)
+		{
+			DocumentGDN* pWin = new DocumentGDN(implPtr, (HWND)hWnd);
+			return pWin;
+		}
+	public:
+		//xdwgrid	dw_list;
+		xlistview  lv_view;
+		xnode	m_agentNode;	//Agent Condition
+		int columnCount;
+		xstring entityid;
+		int hObject = 0;
+		xstring Type;
+
+		int SetAgent()
+		{
+			xstring xfNodeAgentArea = L"agentarea";
+			xnode anode = GetAgentNode(xfNodeAgentArea);
+			if (m_agentNode)
+			{
+				//SetAgentNodeContent
+				SetAgentNode(anode, m_agentNode);
+			}
+			else
+			{
+				KXMLDOMElement xframeElement = GetElement();
+				KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*");
+				if (agent)
+				{
+					xstring s = agent.xml();
+					m_agentNode = SetAgentNode(anode, s);
+				}
+			}
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(TEvent* evt, LPARAM p)
+		{
+			//重置工具条
+			SetAgent();
+			return 1;
+		}
+
+		int OnListViewDoubleClicked(TEvent* evt, LPARAM p)
+		{
+			//重置工具条
+			//SetAgent();
+
+			OnDocumentOpen();
+			//CloseWindow();
+			return 1;
+		}
+
+		int OnDocumentOpen()
+		{
+			//return 1;
+
+			int  LVNI_ALL = 0x0000;
+			int  LVNI_FOCUSED = 0x0001;
+			int  LVNI_SELECTED = 0x0002;
+			int  LVNI_CUT = 0x0004;
+			int  LVNI_DROPHILITED = 0x0008;
+
+			int nItem = lv_view.GetNextItem( -1, LVNI_FOCUSED);
+			if (nItem < 0) return 1;
+
+			int LVIF_PARAM = 0x0004;
+
+			lvitem lvItem;
+			lvItem.iItem = nItem;
+			lvItem.iSubItem = 0;
+			lvItem.mask = LVIF_PARAM;
+
+			lv_view.GetItem( lvItem);
+			KXMLDOMElement ele = lvItem.lParam;
+
+			xstring src = ele.getAttribute(L"url");
+			xstring name = ele.getAttribute(L"caption");
+			xstring file = L"";
+			if (src.find(L"/file/") > 0) file = src.mid(src.find(L"/file/") + 6, 9999);
+			if (file == L"") return 1;
+			xstring str = file.left(2);
+			xstring ext = L"";
+			if (name.find(L".") >= 0) ext = name.mid(name.find(L"."), name.length());
+			xstring sfile = file;
+
+			xaserverarg arg ;
+			if (arg)
+			{
+				arg.AddArg(L"result", L"ok");
+				if ((arg.GetArgString(L"process") == L"path" || arg.GetArgString(L"process") == L"data"))
+				{
+					arg.AddArg(L"path", src);
+					arg.AddArg(L"filename", name);
+					arg.AddArg(L"src", L"/business/attachment/" + str + L"/" + file + L".jpg");
+					if (arg.GetArgString(L"process") == L"path") return 1;
+				}
+			}
+
+
+			/*
+			const xstring d = m_Html.GetData(p.object);
+			if(d == L"") return -1;
+			xstring file = d.mid(0, d.find(L"|##@@|",0));
+			xstring name = d.mid(d.find(L"|##@@|",0)+6, d.length());
+			*/
+		
+			xaserver::CreateDirectory(L"C:/Temp");
+			if (arg)
+			{
+				if (arg.GetArgString(L"process") == L"data")
+				{
+					xml x ;
+					
+					xaserver::LoadUrl(GetServerUrl(), L"/business/attachment/" + str + L"/" + file + L".jpg", L"", x);
+					arg.AddArg(L"data", x.xml());
+					return 1;
+				}
+			}
+
+			int openRet = xaserver::DownLoadFile(GetServerUrl(), L"/business/attachment/" + str + L"/" + file + L".jpg", L"", L"C:/Temp/" + sfile + ext);
+
+
+
+			//alert(L"/business/attachment/"+str+L"/"+ file+L".jpg");
+			if (openRet < 0)
+			{
+				alert(L"文件打开失败1!");
+				return -1;
+			}
+			//openRet = ShellExecuteW(0,L"open",L"C:/Temp/"+name,L"",L"",5);	
+			openRet = ShellExecuteW(0, L"open", L"C:/Temp/" + sfile + ext, L"", L"", 5);
+			if (openRet < 32)
+			{
+				alert(L"文件打开失败2!");
+				return -1;
+			}
+
+			return 1;
+		}
+
+		int OnAddAttachment()
+		{
+			xstring sguid = publiccode::GetGuid();
+			xstring sname = sguid;
+			xstring str = sname.mid(0, 2);
+			str = str.toUpper();
+			xstring suri = L"attachment" + str;
+			xstring ret = xaserver::UploadFile(suri, sname + L".jpg", GetHWND(), L"", false);
+			if (ret == L"-1")
+			{
+				alert(L"上传的文件没选择!");
+				return 0;
+			}
+			else
+			{
+				while (ret.find(L"\\", 0) >= 0)
+					ret = ret.mid(ret.find(L"\\", 0) + 1, 9999);
+
+
+				xstring myurl = L"object/GDN/"+Type;
+			
+				xml x;
+				
+				xaserverarg args ;
+				
+				args.AddArg(L"myurl", myurl);
+				args.AddArg(L"name", ret);
+				args.AddArg(L"filepath", sname);
+				args.AddArg(L"fileext", L"");
+				args.AddArg(L"filesource", ret);
+				args.AddArg(L"entityid", entityid);
+				
+
+				/*xml x1 = ViewObject::RetrieveData(L"/sale/data/TDocument3/attachment/GetFileFormat",L"Name",ret);
+				KXMLDOMNodeList items = x1.GetXmlDoc().selectNodes(L"data/Item");
+				KXMLDOMNode t = items.item(0);
+				xstring FileFormat=L"";
+				if(t.selectSingleNode(L"FileFormat"))FileFormat=t.selectSingleNode(L"FileFormat").text;
+				if(FileFormat !=L"pdf" && FileFormat !=L"PDF")
+				{
+					alert(L"请上传PDF格式的文件");
+					return 0;
+				}*/
+				//alert(L"myurl:"+myurl+L"--name:"+ret+L"--filepath:"+sname+L"--filesource:"+ret+L"--entityid:"+entityid);
+				if (xurl::get(L"/sale/data/TDocument3/attachment/addex", args.GetString(), x) != 1)
+				{
+					alert(L"保存出错了!");
+					return 0;
+				}
+				else
+				{
+					alert(x.text());
+					Retrieve(entityid);
+				}
+			}
+			return 0;
+		}
+#if 0
+		int OnDocumentOpen()
+		{
+			int  LVNI_ALL = 0x0000;
+			int  LVNI_FOCUSED = 0x0001;
+			int  LVNI_SELECTED = 0x0002;
+			int  LVNI_CUT = 0x0004;
+			int  LVNI_DROPHILITED = 0x0008;
+
+			int nItem = lv_view.GetNextItem( -1, LVNI_FOCUSED);
+			if (nItem < 0) return 1;
+
+			int LVIF_PARAM = 0x0004;
+
+			lvitem lvItem;
+			lvItem.iItem = nItem;
+			lvItem.iSubItem = 0;
+			lvItem.mask = LVIF_PARAM;
+
+			lv_view.GetItem( lvItem);
+			KXMLDOMElement ele = lvItem.lParam;
+
+			xstring src = ele.getAttribute(L"url");
+			xstring file = L"";
+			if (src.find(L"/file/") > 0) file = src.mid(src.find(L"/file/") + 6, 9999);
+			if (file == L"") return 1;
+
+			xstring name = ele.getAttribute(L"caption");
+			
+			xaserver::CreateDirectory(L"C:/Temp");
+			xstring str = file.left(2);
+			xstring ext = L"";
+			if (name.find(L".") >= 0) ext = name.mid(name.find(L"."), name.length());
+			xstring sfile = file;
+			int openRet = xaserver::DownLoadFile(GetServerUrl(), L"/business/attachment/" + str + L"/" + file + L".jpg", L"", L"C:/Temp/" + sfile + ext);
+
+			if (openRet < 0)
+			{
+				alert(L"文件打开失败1!");
+				return -1;
+			}
+
+			openRet = ShellExecuteW(0, L"open", L"C:/Temp/" + sfile + ext, L"", L"", 5);
+			if (openRet < 32)
+			{
+				alert(L"文件打开失败2!");
+				return -1;
+			}
+
+			return -1;
+		}
+#endif
+		int OnDeleteFile()
+		{
+			int  LVNI_ALL = 0x0000;
+			int  LVNI_FOCUSED = 0x0001;
+			int  LVNI_SELECTED = 0x0002;
+			int  LVNI_CUT = 0x0004;
+			int  LVNI_DROPHILITED = 0x0008;
+
+			int nItem = lv_view.GetNextItem( -1, LVNI_FOCUSED);
+			if (nItem < 0) return 1;
+
+			int LVIF_PARAM = 0x0004;
+
+			lvitem lvItem;
+			lvItem.iItem = nItem;
+			lvItem.iSubItem = 0;
+			lvItem.mask = LVIF_PARAM;
+
+			lv_view.GetItem( lvItem);
+			KXMLDOMElement ele = lvItem.lParam;
+
+			xstring src = ele.getAttribute(L"url");
+			xstring file = L"";
+			if (src.find(L"/file/") > 0) file = src.mid(src.find(L"/file/") + 6, 9999);
+			if (file == L"") return 1;
+
+			xstring name = ele.getAttribute(L"caption");
+			if (MessageBoxW(GetHWND(), L"确定要删除文件" + name + L"?", L"提示", 1) == 2)
+				return 0;
+
+			xaserverarg arg ;
+			
+			arg.AddArg(L"filepath", file);
+			xml x ;
+			if (xurl::get(L"/sale/data/TDocument3/file/delete", arg.GetString(), x) != 1)
+			{
+				alert(L"删除出错了!");
+				return 1;
+			}
+			else
+			{
+				//alert(x.GetXmlDoc().text);
+				lv_view.DeleteItem( nItem);
+			}
+
+			return 1;
+		}
+
+		xstring GetPayType()
+		{
+			xcombobox cbx_type = GetControl(L"cbx_type");
+			int h = cbx_type.GetCurSel();
+			if (h < 0) return L"";
+			return cbx_type.GetLBText( h);
+		}
+
+		//命令发布函数
+		int OnCmdDispatch(xstring comdid)
+		{
+			if (comdid == L"xmOpen")
+			{
+				return OnDocumentOpen();
+			}
+			
+			if (comdid == L"xmUpload")
+			{
+					return OnAddAttachment();
+			}
+			if (comdid == L"xmDelete")
+			{
+					return OnDeleteFile();
+			}
+			if (comdid == L"xmClose")
+			{
+				CloseWindow();
+				return 1;
+			}
+			return 0;
+		}
+
+		//命令处理事件
+		int OnXCommand(TEvent* evt, LPARAM param)
+		{
+			return OnCmdDispatch(evt->xcommand.pStrID);
+		}
+
+		int OnAttachEvent()
+		{
+			//绑定工具条点击事件
+			AttachEvent(L"WM_XCOMMAND", (FEvent)&DocumentGDN::OnXCommand);
+			//获取焦点事件,用于重置工具条
+			//AttachEvent(L"WM_SETFOCUS",OnSetFocus);
+			return 1;
+		}
+
+		/*
+		int  OnRetrieve()
+		{
+			xml x ;
+			x.setNativePointer(xml::CreateInstance());
+			xaserverarg arg = new xaserverarg;
+			arg.setNativePointer(arg.CreateInstance());
+			arg.AddArg(L"xxx",L"xxx");
+			if (getUrl(L"",arg.GetString(),x)!=1)
+			{
+				trace(x.GetXmlDoc().text);
+				return -1;
+			}else
+			{
+				//dw_list.Retrieve(x);
+				//dw_list.Redraw();
+			}
+			return 1;
+		}
+		*/
+
+		int SetListViewHeaderColumn(xstring Url)
+		{
+			const int LVCFMT_LEFT = 0;
+			for (int i = 0; i < 3; i++)  lv_view.DeleteColumn( 1);
+			lv_view.InsertColumn( 0, L"类型", 0, 80, 0);
+			lv_view.InsertColumn( 0, L"创建日期", LVCFMT_LEFT, 80, 0);
+			lv_view.InsertColumn( 0, L"创建人员", LVCFMT_LEFT, 80, 0);
+			lv_view.InsertColumn( 0, L"名称", 0, 120, 0);
+
+			columnCount = 3;
+			return 1;
+		}
+
+		int Retrieve(xstring entityid)
+		{
+			lv_view.DeleteItemAll();
+			xstring src = L"object/GDN/" + Type;
+			xml x = ViewObject::RetrieveData(L"/sale/data/TDocument3/folder/listex", L"src", src, L"entityid", entityid);
+			if (x)
+			{
+				KXMLDOMElement ele = x.documentElement();
+				KXMLDOMNodeList nlist = ele.selectNodes(L"*");
+				int s = nlist.length();
+				if (s > 0)
+				{
+					for (int i = 0; i < s; i++)
+					{
+						KXMLDOMElement e = nlist.item(i);
+						xstring name = e.getAttribute(L"caption");
+
+						int nItem = lv_view.InsertItemEx( 0, name, 23,e);
+						lv_view.SetItemText( nItem, 1, e.getAttribute(L"Creator"));
+						lv_view.SetItemText( nItem, 2, e.getAttribute(L"CreateDate"));
+						lv_view.SetItemText( nItem, 3, e.getAttribute(L"Type"));
+
+					}
+				}
+			}
+			return 1;
+		}
+
+		
+
+		int onload()
+		{
+			SetArg();
+			lv_view = GetControl(L"lv_view");
+			columnCount = 0;
+			SetListViewHeaderColumn(L"");
+			AttachEvent(L"lv_view", L"NM_DBLCLK", (FEvent)&DocumentGDN::OnListViewDoubleClicked);
+
+			if (GetWinParam())
+			{
+				xaserverarg arg= GetArg();
+				entityid = arg.GetArgString(L"entityid");
+				Type = arg.GetArgString(L"Type");
+				Retrieve(entityid);
+			}
+
+			OnAttachEvent();
+			return 1;
+		}
+
+		int onloaded()
+		{
+			//SetAgent();			
+
+			return 1;
+		}
+	};
diff --git a/jrj/project/business/GDN3.list.cpp b/jrj/project/business/GDN3.list.cpp
index 1ca80ae..c4117de 100644
--- a/jrj/project/business/GDN3.list.cpp
+++ b/jrj/project/business/GDN3.list.cpp
@@ -441,6 +441,38 @@
 			OpenWindow(L"dev:xpage[GDNDelay.vx]", argEx);
 			return 1;
 		}
+		else if (comdid == L"action:bill.Upload")
+		{
+			
+			int row = dw_list.GetRow();
+			if (row < 1) return 1;
+			xstring GDNID2 = dw_list.GetGuid(dw_list.GetRow());
+			xaserverarg& arg = *new xaserverarg();
+
+			if (GDNID2.length() <= 0)return 1;
+
+			arg.AddArg(L"entityid", GDNID2);
+			arg.AddArg(L"Type", L"Card");
+			OpenWindow(L"dev:xpage[maint.Document.GDN.v3.vx]", arg);
+
+			return 1;
+		}
+		else if (comdid == L"action:bill.UploadEx")
+		{
+
+			int row = dw_list.GetRow();
+			if (row < 1) return 1;
+			xstring GDNID3 = dw_list.GetGuid(dw_list.GetRow());
+			xaserverarg& arg = *new xaserverarg();
+
+			if (GDNID3.length() <= 0)return 1;
+
+			arg.AddArg(L"entityid", GDNID3);
+			arg.AddArg(L"Type", L"Inspection");
+			OpenWindow(L"dev:xpage[maint.Document.GDN.v3.vx]", arg);
+
+			return 1;
+		}
 		else if (comdid == L"action:bill.check.ask")
 		{
 			int row = dw_list.GetRow();

--
Gitblit v1.9.3