From a45547cb13fde42a735daf910cf2ffcedd3a12d6 Mon Sep 17 00:00:00 2001
From: xj qian <qianxj15@sina.com>
Date: 星期五, 28 六月 2024 10:09:23 +0800
Subject: [PATCH] update quote enquiry

---
 jrj/project/business/SO/Product.FetchNo.cpp |  336 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 jrj/ext-jrj/ext-jrj.vcxproj                 |    1 
 2 files changed, 337 insertions(+), 0 deletions(-)

diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj
index 49ca2cc..75dc6eb 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj
+++ b/jrj/ext-jrj/ext-jrj.vcxproj
@@ -294,6 +294,7 @@
     <ClCompile Include="..\project\business\SO\paymentterm.base.maint.so.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     </ClCompile>
+    <ClCompile Include="..\project\business\SO\Product.FetchNo.cpp" />
     <ClCompile Include="..\project\business\SO\Product.Select.SO.cpp">
       <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
     </ClCompile>
diff --git a/jrj/project/business/SO/Product.FetchNo.cpp b/jrj/project/business/SO/Product.FetchNo.cpp
new file mode 100644
index 0000000..4b837d9
--- /dev/null
+++ b/jrj/project/business/SO/Product.FetchNo.cpp
@@ -0,0 +1,336 @@
+#include <wobject/xstring.hpp>
+#include <xcontrol/xtreeview.hpp>
+#include <xcontrol/xdwgrid.hpp>
+#include <xcontrol/xcell.hpp>
+
+
+#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+
+using xml = KXMLDOMDocument;
+	class  __declspec(dllexport)  ProductFetchNoWin : public xframe
+	{
+	public:
+		xdwgrid	dw_list;
+
+		xnode	m_agentNode;	//Agent Condition
+	public:
+		ProductFetchNoWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
+	public:
+		static ProductFetchNoWin* CreateInstance(void* implPtr, void* hWnd)
+		{
+			ProductFetchNoWin* pWin = new ProductFetchNoWin(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)
+				{
+					xstring s = agent.xml();
+					m_agentNode = SetAgentNode(anode, s);
+				}
+			}
+			return 1;
+		}
+
+		int OnRowChanged(TEvent* evt, LPARAM p)
+		{
+			DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
+			int row = hdr.row;
+
+			/*
+			htmlctrl xs = GetControl(L"html_detail");
+			xstring html = makeHtml(row);
+			xs.SetContent(html);
+			xs.Redraw();
+
+			xstring id = g_xdoc_product.getData(0,L"data/Item",row,L"@guid");
+			OnShowImage(id);
+			*/
+
+			return 1;
+		}
+
+		//焦点激活处理函数
+		int OnSetFocus(TEvent* evt, LPARAM p)
+		{
+			//重置工具条
+			//SetAgent();
+			return 1;
+		}
+
+		int SendNotice()
+		{
+			xaserverarg arg;
+			
+			if (dw_list.GetRowCount() < 1) return 1;
+			xstring Subject = L"编号:" + dw_list.GetItemString(dw_list.GetRow(), L"SKUNo") + L"   品名:" + dw_list.GetItemString(dw_list.GetRow(), L"CName") + L",申请货号";
+			xstring EntityID = dw_list.GetItemString(dw_list.GetRow(), L"SKUID");
+			xstring EntityNo = dw_list.GetItemString(dw_list.GetRow(), L"SKUNo");
+			xstring Category = L"货号申请";
+			xstring Reciever = L"00908";
+			xstring Content = L"";
+			//alert(L"EntityID:"+EntityID);
+			xml x = ViewObject::AddMessage(Category, Reciever, EntityNo, EntityID, Subject, Content);
+			return 1;
+		}
+
+		int OnSubmit()
+		{
+			dw_list = GetControl(L"dw_list");
+			if (dw_list.GetRowCount() < 1) return 0;
+			xml x;
+			
+			dw_list.DwUpdateAllToEx(x);
+			xstring error = L"";
+			xaserverarg arg;
+			
+			arg.AddArg(L"content", x.xml());
+			if (xurl::get(L"/sale/data/ProductLibrary3/update/product/askgoodsno", arg.GetString(), x) != 1)
+			{
+				xstring error = x.text();
+				trace(error);
+			}
+			else
+			{
+				if (error.find(L"error") >= 0)
+					alert(L"提交失败");
+				else
+					alert(L"提交成功!");
+				SendNotice();
+			}
+			return 1;
+		}
+
+		/*
+		xstring makeHtml(int row)
+		{
+			xstring id = g_xdoc_product.getData(0,L"data/Item",row,L"@guid");
+			xml x = GetGoodsPropList(id);
+			xml x1 = GetGoodsPropListEx(id);
+
+			xstring html=L"<html><style> .text{ font-weight:400} .label { font-weight:400;}</style><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'>";
+			html += L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >编号:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"SKUNo")+
+						"</span> <span style='font-weight:700;width:50;font-size:10pt' >类项:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"RefNo")+
+						"</span></div>";
+			html +=  L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >公司型号:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"GoodsNo")+
+						"</span></div>" ;
+			html +=  L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >品名:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"CName")+
+						"</span></div>" ;
+			if(dw_list.GetItemString(row,L"CSpec")!=L"")
+				html +=  L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >规格:</span><span  style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"CSpec")+
+							"</span></div>" ;
+
+			KXMLDOMNodeList fieldsEx = x1.GetXmlDoc().selectNodes(L"data/field");
+			xstring ls_detail=L"";
+			xstring ls_item =L"";
+			xstring name;
+			xstring label;
+			int len = fieldsEx.length;
+			int i= 0;
+
+			for(i=0;i<len; true)
+			{
+				int cnt  = 0;
+				ls_item = L"";
+				while(cnt < 2)
+				{
+					name = fieldsEx.item(i).selectSingleNode(L"@name").text;
+					label  = fieldsEx.item(i).selectSingleNode(L"@label").text;
+					ls_item += L"<td>" + label + L"</td>" + L"<td style='text-align:center'>" + g_xdoc_product.getData(0,L"data/Item",row,name) + L"</td>" ;
+					cnt++;
+					i++;
+					if(i ==len)break;
+				}
+				ls_detail += L"<tr>" + ls_item + L"</tr>";
+			}
+			html +=  L"<div style='margin-left:8px;margin-right:16px;'>" +
+						+L"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>"
+						+ ls_detail
+						+L"</table>"
+						+L"</div>" ;
+
+			xstring ls_star=L"";
+			KXMLDOMNodeList fields  = x().selectNodes(L"data/field");
+			len = fields.length;
+
+			ls_detail = L"";
+			if(len > 0)
+				html +=  L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >技术要求:</span></div>" ;
+			for(i=0;i<len; true)
+			{
+				ls_item=L"";
+
+				int count = 0;
+				while(count < 2)
+				{
+					name = fields.item(i).selectSingleNode(L"@name").text;
+					label  = fields.item(i).selectSingleNode(L"@label").text;
+					if(name==L"QualityTerm" || name==L"PackTerm" || label==L"质量" || label==L"包装质量" || label==L"技术要求")
+					{
+						i++;
+						if(i >= len)count = 2;
+						continue;
+					}
+					else if(g_xdoc_product.getData(0,L"data/Item",row,name)==L"")
+					{
+						KXMLDOMNodeList options = fields.item(i).selectNodes(L"item");
+						int tlen = options.length;
+						xstring terms = L"" ;
+						for(int k=0; k<tlen; k++)
+						{
+							if(options.item(k).text)
+							{
+								if(k>0) terms += L", L";
+								terms += L"[" + options.item(k).text +L"]";
+							}
+						}
+						ls_star += L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >" + label +L"*:</span><span  style='width:90;font-size:10pt'>" + terms + L"</span></div>" ;
+					}else
+					{
+						ls_item = L"<td>" + label + L"</td>" + L"<td>" + g_xdoc_product.getData(0,L"data/Item",row,name) + L"</td>" ;
+						count++;
+					}
+					i++;
+					if(i >= len)count = 2;
+				}
+				ls_item = L"<tr>" + ls_item + L"</tr>";
+				ls_detail += ls_item;
+			}
+
+			html +=  L"<div style='margin-left:8px;margin-right:16px;'>" +
+						+L"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>"
+						+ ls_detail
+						+L"</table>"
+						+L"</div>" ;
+			if(dw_list.GetItemString(row,L"QualityTerm")!=L"")
+			{
+				html +=  L"<div style='height:12px'/>";
+				html +=  L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >质量:</span></div>" ;
+				html +=  L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt'  >" + dw_list.GetItemString(row,L"QualityTerm") +  L"</span></div>" ;
+			}
+
+			if(dw_list.GetItemString(row,L"PackTerm")!=L"")
+			{
+				html +=  L"<div style='height:12px'/>";
+				html +=  L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >包装质量:</span></div>" ;
+				html +=  L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row,L"PackTerm") +  L"</span></div>" ;
+			}
+
+			if(g_xdoc_product.getData(0,L"data/Item",row,L"Remark")!=L"")
+			{
+				//html +=  L"<div style='height:12px'/>";
+				html +=  L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >备注:</span></div>" ;
+				html +=  L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + g_xdoc_product.getData(0,L"data/Item",row,L"Remark") +  L"</span></div>" ;
+			}
+
+			html +=  L"<div style='height:24px'/>";
+
+			//星标项
+			html += ls_star;
+
+
+			html += L"</body></html>";
+			//trace(html);
+			return html;
+		}
+		*/
+
+		//命令发布函数
+		int OnCmdDispatch(xstring comdid)
+		{
+			if (comdid == L"xmSubmit")
+			{
+				return OnSubmit();
+			}
+			if (comdid == L"xmCancel")
+			{
+				CloseWindow();
+				return 1;
+			}
+			return 0;
+		}
+
+		//命令处理事件
+		int OnXCommand(TEvent* evt, LPARAM p)
+		{
+			return OnCmdDispatch(evt->xcommand.pStrID);
+		}
+
+		int OnAttachEvent()
+		{
+			AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductFetchNoWin::OnRowChanged);
+			//绑定工具条点击事件
+			AttachEvent(L"WM_XCOMMAND", (FEvent)&ProductFetchNoWin::OnXCommand);
+			//获取焦点事件,用于重置工具条
+			AttachEvent(L"WM_SETFOCUS", (FEvent)&ProductFetchNoWin::OnSetFocus);
+		}
+
+		/*
+		int  OnRetrieve()
+		{
+			xml x = new.xml();
+			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().text);
+				return -1;
+			}else
+			{
+				//dw_list.Retrieve(x);
+				//dw_list.Redraw();
+			}
+			return 1;
+		}
+		*/
+
+		int onload()
+		{
+			dw_list = GetControl(L"dw_list");
+			dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"").GetXmlDoc());
+			dw_list.SetColumnState(L"SKUID", false);
+			dw_list.SetColumnState(L"category1", false);
+			dw_list.SetColumnState(L"Submitter1", false);
+
+			if (GetWinParam())
+			{
+				xaserverarg arg;
+				xml x;
+				
+				if (xurl::get(L"/sale/data/ProductLibrary3/data/list/skunolist", arg.GetString(), x) != 1)
+				{
+					xstring error = x.text();
+					trace(error);
+				}
+				else
+				{
+					//alert(x.GetXml());
+					dw_list.Retrieve(x);
+				}
+			}
+			OnAttachEvent();
+			dw_list.SetReadOnly(true);
+
+			return 1;
+		}
+
+		int onloaded()
+		{
+			//SetAgent();			
+
+			return 1;
+		}
+	};
\ No newline at end of file

--
Gitblit v1.9.3