From 703d27d52ba0ac373b62aedb93f9cfe9f8857ed2 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期三, 25 九月 2024 17:19:56 +0800
Subject: [PATCH] update

---
 jrj/project/business/QuoteFile.cpp                   |   21 ++++++
 jrj/project/business/Quote/QuoteFilePurch2Select.cpp |  151 ++++++++++++++++++++++++++++++++++++++++++++++++++
 jrj/ext-jrj/ext-jrj.vcxproj                          |    1 
 3 files changed, 171 insertions(+), 2 deletions(-)

diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj
index 141efbd..30ebd76 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj
+++ b/jrj/ext-jrj/ext-jrj.vcxproj
@@ -882,6 +882,7 @@
     <ClCompile Include="..\project\business\Quote\QuoteFilePurch.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\project\business\Quote\QuoteFilePurch2Select.cpp" />
     <ClCompile Include="..\project\business\Quote\QuoteFilePurched.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild>
     </ClCompile>
diff --git a/jrj/project/business/Quote/QuoteFilePurch2Select.cpp b/jrj/project/business/Quote/QuoteFilePurch2Select.cpp
new file mode 100644
index 0000000..702a620
--- /dev/null
+++ b/jrj/project/business/Quote/QuoteFilePurch2Select.cpp
@@ -0,0 +1,151 @@
+#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 <xcontrol/xshtml.hpp>
+
+
+#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+
+using xml = KXMLDOMDocument;
+class __declspec(dllexport) QuoteFilePurch2Select :  public xframe
+{
+public:
+	xdwgrid dw_process;
+
+	xnode	m_agentNode;	//Agent Condition
+	xstring EntityID;
+
+public:
+	QuoteFilePurch2Select(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
+public:
+	static QuoteFilePurch2Select* CreateInstance(void* implPtr, void* hWnd)
+	{
+		return  new QuoteFilePurch2Select(implPtr, (HWND)hWnd);
+	}
+
+	int SetAgent()
+	{
+		return 1;
+	}
+
+	int OnRowChanged(TEvent* evt, LPARAM p)
+	{
+		//fixed one event only one process
+		DWNMHDR&  hdr = *(DWNMHDR*)evt->notify.pnmh;
+		int row = hdr.row;
+		KXMLDOMElement ele = dw_process.GetRowElement(row);
+
+		xaserverarg arg ;
+		arg.AddArg(L"content", ele.xml());
+		xml doc;
+		if (getUrl(L"/sale/data/vpage/vstart/task", arg.GetString(), doc) != 1)
+		{
+			trace((xstring)L"error->:" + doc.xml());
+			return 0;
+		}
+		if ((xstring)doc.xml() == L"")
+			return -1;
+
+		xshtml ht = GetControl(L"taskinfo");
+		ht.SetContent(doc.xml());
+		ht.Redraw();
+		return 1;
+	}
+
+	int RetrieveData()
+	{
+		xml x = ViewObject::RetrieveData(L"/sale/data/business/list/task/quote/enquiry", L"Category", L"QuoteEnquiry",
+			L"EntityID", EntityID);
+		dw_process.Retrieve(x);
+		dw_process.Redraw();
+		dw_process.SetReadOnly(true);
+		return 1;
+	}
+
+	//焦点激活处理函数
+	int OnSetFocus(TEvent* evt, LPARAM param)
+	{
+		//重置工具条
+		SetAgent();
+		return 1;
+	}
+
+	//命令发布函数
+	int OnCmdDispatch(xstring comdid)
+	{
+		if (comdid == L"xmOk")
+		{
+			int row = dw_process.GetRow();
+			if (row > 0)
+			{
+				xstring TaskID = dw_process.GetItemString(row, L"taskid");
+				if (GetWinParam())
+				{
+					xaserverarg arg = GetArg();
+					arg.AddArg(L"TaskID", TaskID);
+					CloseWindow();
+					return 1;
+				}
+			}
+			return 1;
+		}
+		if (comdid == L"xmCancel")
+		{
+			CloseWindow();
+			return 1;
+		}
+
+		return 0;
+	}
+
+	//命令处理事件
+	int OnXCommand(TEvent* evt, int param)
+	{
+		return OnCmdDispatch(evt->xcommand.pStrID);
+	}
+
+
+	int OnAttachEvent()
+	{
+		//绑定工具条点击事件
+		AttachEvent(L"WM_XCOMMAND", (FEvent)&QuoteFilePurch2Select::OnXCommand);
+		//获取焦点事件,用于重置工具条
+		//AttachEvent("WM_SETFOCUS",OnSetFocus);
+		AttachEvent(L"dw_process", L"DWV_ROWFOCUSCHANGED", (FEvent)&QuoteFilePurch2Select::OnRowChanged);
+		//AttachEvent("dw_process","DWV_ASKSTYLE",OnItemAskStyle);
+		//AttachEvent("dw_process","DWV_DOUBLECLICKED",OnDoubleClicked);
+		return 1;
+	}
+
+	int onload()
+	{
+		SetArg();
+		//dw_process = GetControl("xxx");
+		//dw_process.openUrl("xxx");
+		dw_process = GetControl(L"dw_process");
+		dw_process.openUrl(L"/sale/view/Business3/template/QuoteFilePurchrList");
+		dw_process.SetColumnState(L"taskid", false);
+		dw_process.SetColumnState(L"EntityID", false);
+		dw_process.SetColumnState(L"Category", false);
+		dw_process.SetColumnState(L"content2", false);
+		dw_process.SetAskStyle(true);
+
+		EntityID = L"";
+		if (GetWinParam())
+		{
+			xaserverarg arg = GetArg();
+			EntityID = arg.GetArgString(L"EntityID");
+			arg.AddArg(L"TaskID", L"");
+		}
+
+		OnAttachEvent();
+		RetrieveData();
+
+		return 1;
+	}
+
+};
\ No newline at end of file
diff --git a/jrj/project/business/QuoteFile.cpp b/jrj/project/business/QuoteFile.cpp
index 8cc020a..c1a716a 100644
--- a/jrj/project/business/QuoteFile.cpp
+++ b/jrj/project/business/QuoteFile.cpp
@@ -3445,6 +3445,10 @@
 			//if(makeMessage(L"/task/quote/purchar/backtosaler")==-1) return 1;
 			return OnSaleBack();
 		}
+		else if (comdid == L"xmPurch2")
+		{
+			return OnPurch2();
+		}
 		else if (comdid == L"xmPurch")
 		{
 			return OnPurch();
@@ -3554,10 +3558,10 @@
 			if (action == L"purch")
 			{
 				int crow = dw_cell.GetRow();
-				xstring cmd = comdid.mid(3, comdid.length());
-				if (getRowID(dw_cell, crow) == L"") SendCtrlCmd(dw_cell, cmd);
+				if (getRowID(dw_cell, crow) == L"") SendCtrlCmd(dw_cell, comdid);
 				return 1;
 			}
+			return 1;
 		}
 		return 0;
 	}
@@ -3592,6 +3596,19 @@
 		return 1;
 	}
 
+	int OnPurch2()
+	{
+		xaserverarg arg;
+		arg.AddArg(L"EntityID", entityID);
+		OpenWindow(L"dev:xpage[QuoteFilePurch2Select.vx]", arg);
+		xstring taskID = arg.GetArgString(L"TaskID");
+		if (taskID != L"")
+		{
+			ProcessSendMessage(L"/task/quote/repurch", taskID, L"", L"", true);
+		}
+		return 1;
+	}
+
 	int OnSaveEx(bool balert = false)
 	{
 		//dw_cell.AcceptText();

--
Gitblit v1.9.3