From 603ce4df28d440b9faf989073d6a587cf4065d67 Mon Sep 17 00:00:00 2001
From: LiFan <2308045698@qq.com>
Date: 星期三, 05 三月 2025 16:45:22 +0800
Subject: [PATCH] update
---
jrj/project/business/SystemSettings/CommentaryEx.dialog.cpp | 250 +++++++++++++++++++++++++++
jrj/ext-jrj/ext-jrj.vcxproj | 6
jrj/project/business/SystemSettings/Commentary.dialog.cpp | 269 +++++++++++++++++++++++++++++
jrj/ext-jrj/ext-jrj.vcxproj.filters | 6
4 files changed, 531 insertions(+), 0 deletions(-)
diff --git a/jrj/ext-jrj/ext-jrj.vcxproj b/jrj/ext-jrj/ext-jrj.vcxproj
index 6fe1efa..107fc38 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj
+++ b/jrj/ext-jrj/ext-jrj.vcxproj
@@ -1044,6 +1044,12 @@
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
</ClCompile>
+ <ClCompile Include="..\project\business\SystemSettings\Commentary.dialog.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
+ <ClCompile Include="..\project\business\SystemSettings\CommentaryEx.dialog.cpp">
+ <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
+ </ClCompile>
<ClCompile Include="..\project\business\SystemSettings\Data.config.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
diff --git a/jrj/ext-jrj/ext-jrj.vcxproj.filters b/jrj/ext-jrj/ext-jrj.vcxproj.filters
index f8b4313..46be3b7 100644
--- a/jrj/ext-jrj/ext-jrj.vcxproj.filters
+++ b/jrj/ext-jrj/ext-jrj.vcxproj.filters
@@ -1604,6 +1604,12 @@
<ClCompile Include="..\project\business\Expense\PremiumRateList.cpp">
<Filter>project\business\Expense</Filter>
</ClCompile>
+ <ClCompile Include="..\project\business\SystemSettings\Commentary.dialog.cpp">
+ <Filter>project\business\SystemSettings</Filter>
+ </ClCompile>
+ <ClCompile Include="..\project\business\SystemSettings\CommentaryEx.dialog.cpp">
+ <Filter>project\business\SystemSettings</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="ext-jrj.def">
diff --git a/jrj/project/business/SystemSettings/Commentary.dialog.cpp b/jrj/project/business/SystemSettings/Commentary.dialog.cpp
new file mode 100644
index 0000000..d6ee7d3
--- /dev/null
+++ b/jrj/project/business/SystemSettings/Commentary.dialog.cpp
@@ -0,0 +1,269 @@
+#include <wobject/xstring.hpp>
+#include <xcontrol/xtreeview.hpp>
+#include <xcontrol/xdwgrid.hpp>
+#include <wobject/xdouble.hpp>
+#include <xcontrol/xlayersheet.hpp>
+
+#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
+#include "viewobject/view.base.hpp"
+using xml = KXMLDOMDocument;
+class __declspec(dllexport) Commentary : public xframe
+{
+
+public:
+
+ string m_EntityID;
+ string m_EntityType;
+ string m_EntityConnect;
+ string m_ConnectID;
+
+ control__ m_Edit;
+ html__ m_Html;
+ combobox__ m_cb;
+public:
+ BindComputerDlgNew(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {}
+public:
+ static BindComputerDlgNew* CreateInstance(void* implPtr, void* hWnd)
+ {
+ BindComputerDlgNew* pWin = new BindComputerDlgNew(implPtr, (HWND)hWnd);
+ return pWin;
+ }
+ string GetGuid() {
+ return TApp::GetGuid();
+ }
+
+ int Init()
+ {
+ if (m_EntityID == "") return -1;
+
+ xml__ x = new xml__;
+ x.setNativePointer(x.CreateInstance());
+ xaserverarg__ arg = new xaserverarg__;
+ arg.setNativePointer(arg.CreateInstance());
+ arg.AddArg("EntityID", m_EntityID);
+ arg.AddArg("EntityType", m_EntityType);
+ arg.AddArg("EntityConnect", m_EntityConnect);
+ if (url::get("/sale/data/Commentary/entity/notelist", arg.GetString(), x) == 1)
+ {
+ //trace(x.GetXml());
+ m_Html.SetContent(x.GetXml());
+ m_Html.Redraw();
+ }
+ return 1;
+ }
+
+ int AppendItem(xml__ x, msxml::IXMLDOMElement r, string name, string value)
+ {
+ var e = x.GetXmlDoc().createElement(name);
+ e.text = value;
+ r.appendChild(e);
+ return 1;
+ }
+
+ int showAtt()
+ {
+ xnode__ anode = new xnode__;
+ anode.setNativePointer(GetAgentNode("att"));
+ int s = combobox__::GetCount(m_cb.GetId());
+ xml__ x = new xml__;
+ x.setNativePointer(xml__::CreateInstance());
+ x.LoadXml("<vbox/>");
+ msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+ //trace(str);
+ int i = 0;
+ for (i = 0; i < s; i++)
+ {
+ string tmp = combobox__::GetLBText(m_cb.GetId(), i);
+ //trace(tmp);
+ var e = x.GetXmlDoc().createElement("hbox");
+ e.setAttribute("height", "20");
+ var l = x.GetXmlDoc().createElement("xlabel");
+ l.setAttribute("caption", "" + tmp);
+ var b = x.GetXmlDoc().createElement("xtoolbutton");
+ b.setAttribute("width", "18");
+ b.setAttribute("name", "att_" + i.toString());
+ b.setAttribute("image", "1,5");
+ e.appendChild(l);
+ e.appendChild(b);
+ ele.appendChild(e);
+ var g = x.GetXmlDoc().createElement("xlabel");
+ g.setAttribute("height", "2");
+ g.setAttribute("style", "background-color:#000000");
+ ele.appendChild(g);
+ }
+ //trace(ele.xml);
+ SetAgentNodeContent(anode, ele.xml);
+ anode.SetWidthHeight(-1, i * 20 + 1);
+ return 1;
+ }
+
+ int addAtt()
+ {
+ string guid = TApp::GetGuid();
+ string ret = xaserver__::UploadFile("attachment", guid + ".jpg", this.GetHWND(), "", false);
+ //trace(ret);
+ int nIndex = combobox__::AddItem(m_cb.GetId(), ret, guid + ".jpg");
+ showAtt();
+ return 1;
+ }
+
+ int delAtt(string no)
+ {
+ int nIndex = no.toInt();
+ combobox__::DeleteItem(m_cb.GetId(), nIndex);
+ showAtt();
+ return 1;
+ }
+ msxml::IXMLDOMElement getAtt()
+ {
+ int s = combobox__::GetCount(m_cb.GetId());
+ xml__ x = new xml__;
+ x.setNativePointer(xml__::CreateInstance());
+ x.LoadXml("<Attachment/>");
+ msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+ //trace(str);
+ int i = 0;
+ for (i = 0; i < s; i++)
+ {
+ string tmp = combobox__::GetLBText(m_cb.GetId(), i);
+ string tmp2 = combobox__::GetitemData(m_cb.GetId(), i);
+ var e = x.GetXmlDoc().createElement("item");
+ e.setAttribute("name", "" + tmp);
+ e.setAttribute("file", "" + tmp2);
+ ele.appendChild(e);
+ }
+ return ele;
+ }
+ //命令发布函数
+ int OnCmdDispatch(string comdid)
+ {
+ if (comdid == "xmOK")
+ {
+ if (m_EntityID == "") return 1;
+
+ xml__ x = new xml__;
+ x.setNativePointer(xml__::CreateInstance());
+ xaserverarg__ arg = new xaserverarg__;
+ arg.setNativePointer(arg.CreateInstance());
+ string value = m_Edit.GetText();
+ if (value == "")
+ {
+ alert("请填写批注!");
+ return 1;
+ }
+
+ x.LoadXml("<Commentary update.new='1' update.modify='1'/>");
+ msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+ AppendItem(x, ele, "CommentaryID", GetGuid());
+ AppendItem(x, ele, "EntityID", m_EntityID);
+ AppendItem(x, ele, "EntityType", m_EntityType);
+ AppendItem(x, ele, "Remark", value);
+ AppendItem(x, ele, "ParentConnect", m_EntityConnect);
+ AppendItem(x, ele, "ParentCommentaryID", m_ConnectID);
+ AppendItem(x, ele, "CreatorID", xaserver__::GetUserId());
+ ele.appendChild(getAtt());
+
+ //trace(ele.xml);
+ arg.AddArg("content", "<root>" + ele.xml + "</root>");
+
+ if (getUrl("/workflow/action/Commentary/bill.update", arg.GetString(), x) == 1)
+ {
+ //trace(x.GetXml());
+ //alert("添加成功!");
+ m_Edit.SetText("");
+ combobox__::ResetContent(m_cb.GetId());
+ Init();
+ showAtt();
+ return 1;
+ }
+ else
+ {
+ alert("添加失败!");
+ return -1;
+ }
+ }
+ else if (comdid == "xmAtt")
+ {
+ addAtt();
+ }
+ else if (comdid.left(4) == "att_")
+ {
+ delAtt(comdid.right(comdid.length() - 4));
+ }
+ else
+ {
+ CloseWindow();
+ }
+ return 1;
+ }
+
+ //命令处理事件
+ int OnXCommand(ref TXCommandEvent evt, int param)
+ {
+ return OnCmdDispatch(evt.pStrID);
+ }
+
+ int OnHtmlClick(ref TNotifyEvent evt, int p)
+ {
+ ref HTMLNMHDR p = evt.pnmh;
+ const string d = m_Html.GetData(p.object);
+ if (d == "") return -1;
+ string file = d.mid(0, d.find("|##@@|", 0));
+ string name = d.mid(d.find("|##@@|", 0) + 6, d.length());
+
+ xaserver__::CreateDirectory("C:/Temp");
+ int openRet = xaserver__::DownLoadFile(GetServerUrl(), "/business/supplierattachment/" + file, name, "C:/Temp/" + name);
+ if (openRet < 0)
+ {
+ alert("文件打开失败!");
+ return -1;
+ }
+ openRet = win__::ShellExecute(0, "open", "C:/Temp/" + name, "", "", 5);
+ if (openRet < 32)
+ {
+ alert("文件打开失败2!");
+ return -1;
+ }
+
+ return -1;
+ }
+
+ int OnAttachEvent()
+ {
+ //绑定工具条点击事件
+ AttachEvent("WM_XCOMMAND", OnXCommand);
+ AttachEvent("note", "HTC_OBJECTCLICKED", OnHtmlClick);
+ }
+
+ int onload()
+ {
+ OnAttachEvent();
+
+ m_Edit = new control__;
+ m_Edit.setNativePointer(GetControl("Txt"));
+
+ m_Html = new html__;
+ m_Html.setNativePointer(GetControl("note"));
+
+ m_cb = new html__;
+ m_cb.setNativePointer(GetControl("attlist"));
+
+ m_EntityID = "";
+ m_EntityType = "";
+ m_EntityConnect = "";
+ m_ConnectID = "";
+
+ if (this.GetParam())
+ {
+ xaserverarg__ arg = this.GetParam();
+ m_EntityID = arg.GetArgString("EntityID");
+ m_EntityType = arg.GetArgString("m_EntityType");
+ m_EntityConnect = arg.GetArgString("m_EntityConnect");
+ }
+ Init();
+
+ return 1;
+ }
+ ]
+ ]
+]
\ No newline at end of file
diff --git a/jrj/project/business/SystemSettings/CommentaryEx.dialog.cpp b/jrj/project/business/SystemSettings/CommentaryEx.dialog.cpp
new file mode 100644
index 0000000..0c49a7e
--- /dev/null
+++ b/jrj/project/business/SystemSettings/CommentaryEx.dialog.cpp
@@ -0,0 +1,250 @@
+use "xcontrol.vframe.vbusiness.vd"
+use "xbase.vframe.vbusiness.vd"
+use "publiccode.vutil.vbusiness.vd"
+
+unit business
+[
+ class CommentaryEx : public xframe
+ {
+ string m_EntityID;
+ string m_EntityType;
+ string m_EntityConnect;
+ string m_ConnectID;
+
+ xcontrol m_Edit;
+ htmlctrl m_Html;
+ xcombobox m_cb;
+
+ int Init()
+ {
+ if (m_EntityID == "") return -1;
+
+ xml x = new xml;
+ x.setNativePointer(x.CreateInstance());
+ xaserverarg arg = new xaserverarg;
+ arg.setNativePointer(arg.CreateInstance());
+ arg.AddArg("EntityID", m_EntityID);
+ arg.AddArg("EntityType", m_EntityType);
+ arg.AddArg("EntityConnect", m_EntityConnect);
+ if (url::get("/sale/data/Commentary/entity/notelist", arg.GetString(), x) == 1)
+ {
+ m_Html.SetContent(x.GetXml());
+ m_Html.Redraw();
+ }
+ return 1;
+ }
+
+ int AppendItem(xml x, msxml::IXMLDOMElement r, string name, string value)
+ {
+ msxml::IXMLDOMElement e = x.GetXmlDoc().createElement(name);
+ e.text = value;
+ r.appendChild(e);
+ return 1;
+ }
+
+ int showAtt()
+ {
+ xnode anode = GetAgentNode("att");
+ int s = xcombobox::GetCount(m_cb.GetId());
+ xml x = new xml;
+ x.setNativePointer(xml::CreateInstance());
+ x.LoadXml("<vbox/>");
+ msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+ int i = 0;
+ for (i = 0; i < s; i++)
+ {
+ string tmp = xcombobox::GetLBText(m_cb.GetId(), i);
+ msxml::IXMLDOMElement e = x.GetXmlDoc().createElement("hbox");
+ e.setAttribute("height", "20");
+ msxml::IXMLDOMElement l = x.GetXmlDoc().createElement("xlabel");
+ l.setAttribute("caption", "" + tmp);
+ msxml::IXMLDOMElement b = x.GetXmlDoc().createElement("xtoolbutton");
+ b.setAttribute("width", "18");
+ b.setAttribute("name", "att_" + i.toString());
+ b.setAttribute("image", "1,5");
+ e.appendChild(l);
+ e.appendChild(b);
+ ele.appendChild(e);
+ msxml::IXMLDOMElement g = x.GetXmlDoc().createElement("xlabel");
+ g.setAttribute("height", "2");
+ g.setAttribute("style", "background-color:#000000");
+ ele.appendChild(g);
+ }
+ SetAgentNodeContent(anode, ele.xml);
+ anode.SetWidthHeight(-1, i * 20 + 1);
+ return 1;
+ }
+
+ int addAtt()
+ {
+ string guid = publiccode::GetGuid();
+ string str = guid.left(2);
+ string ret = xaserver::UploadFile("attachment" + str, guid + ".jpg", this.GetHWND(), "", false);
+ int nIndex = xcombobox::AddItem(m_cb.GetId(), ret, guid + ".jpg");
+ showAtt();
+ return 1;
+ }
+
+ int delAtt(string no)
+ {
+ int nIndex = no.toInt();
+ xcombobox::DeleteItem(m_cb.GetId(), nIndex);
+ showAtt();
+ return 1;
+ }
+
+ msxml::IXMLDOMElement getAtt()
+ {
+ int s = xcombobox::GetCount(m_cb.GetId());
+ xml x = new xml;
+ x.setNativePointer(xml::CreateInstance());
+ x.LoadXml("<Attachment/>");
+ msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+ int i = 0;
+ for (i = 0; i < s; i++)
+ {
+ string tmp = xcombobox::GetLBText(m_cb.GetId(), i);
+ string tmp2 = xcombobox::GetItemData(m_cb.GetId(), i);
+ msxml::IXMLDOMElement e = x.GetXmlDoc().createElement("item");
+ e.setAttribute("name", "" + tmp);
+ e.setAttribute("file", "" + tmp2);
+ ele.appendChild(e);
+ }
+ return ele;
+ }
+ //命令发布函数
+ int OnCmdDispatch(string comdid)
+ {
+ if (comdid == "xmOK")
+ {
+ if (m_EntityID == "") return 1;
+
+ xml x = new xml;
+ x.setNativePointer(xml::CreateInstance());
+ xaserverarg arg = new xaserverarg;
+ arg.setNativePointer(arg.CreateInstance());
+ string value = m_Edit.GetText();
+ if (value == "")
+ {
+ alert("请填写批注!");
+ return 1;
+ }
+
+ x.LoadXml("<Commentary update.new='1' update.modify='1'/>");
+ msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement;
+ AppendItem(x, ele, "CommentaryID", publiccode::GetGuid());
+ AppendItem(x, ele, "EntityID", m_EntityID);
+ AppendItem(x, ele, "EntityType", m_EntityType);
+ AppendItem(x, ele, "Remark", value);
+ AppendItem(x, ele, "ParentConnect", m_EntityConnect);
+ AppendItem(x, ele, "ParentCommentaryID", m_ConnectID);
+ AppendItem(x, ele, "CreatorID", xaserver::GetUserId());
+ ele.appendChild(getAtt());
+
+ arg.AddArg("content", "<root>" + ele.xml + "</root>");
+
+ if (getUrl("/workflow/action/Commentary/bill.update", arg.GetString(), x) == 1)
+ {
+ m_Edit.SetText("");
+ xcombobox::ResetContent(m_cb.GetId());
+ Init();
+ showAtt();
+ return 1;
+ }
+ else
+ {
+ alert("添加失败!");
+ return -1;
+ }
+ }
+ else if (comdid == "xmAtt")
+ {
+ addAtt();
+ }
+ else if (comdid.left(4) == "att_")
+ {
+ delAtt(comdid.right(comdid.length() - 4));
+ }
+ else
+ {
+ CloseWindow();
+ }
+ return 1;
+ }
+
+ //命令处理事件
+ int OnXCommand(ref TXCommandEvent evt, int param)
+ {
+ return OnCmdDispatch(evt.pStrID);
+ }
+
+ int OnHtmlClick(ref TNotifyEvent evt, int pr)
+ {
+ ref HTMLNMHDR p = evt.pnmh;
+ const string d = m_Html.GetData(p.object);
+ if (d == "") return -1;
+ string file = d.mid(0, d.find("|##@@|", 0));
+ string name = d.mid(d.find("|##@@|", 0) + 6, d.length());
+
+
+ xaserver::CreateDirectory("C:/Temp");
+ string str = file.left(2);
+ string ext = "";
+ if (name.find(".") >= 0) ext = name.mid(name.find("."), name.length());
+ string sfile = file.left(file.length() - 4);
+ //trace("--"+ext +" " + "/business/attachment/"+str+"/"+ file);
+ //int openRet = xaserver::DownLoadFile(GetServerUrl(),"/business/attachment/"+str+"/"+ file,name,"C:/Temp/"+name);
+ int openRet = xaserver::DownLoadFile(GetServerUrl(), "/business/attachment/" + str + "/" + file, "", "C:/Temp/" + sfile + ext);
+ if (openRet < 0)
+ {
+ alert("文件打开失败1!");
+ return -1;
+ }
+ //openRet = win32::ShellExecute(0,"open","C:/Temp/"+name,"","",5);
+ openRet = win32::ShellExecute(0, "open", "C:/Temp/" + sfile + ext, "", "", 5);
+ if (openRet < 32)
+ {
+ alert("文件打开失败2!");
+ return -1;
+ }
+
+ return -1;
+ }
+
+ int OnAttachEvent()
+ {
+ //绑定工具条点击事件
+ AttachEvent("WM_XCOMMAND", OnXCommand);
+ AttachEvent("note", "HTC_OBJECTCLICKED", OnHtmlClick);
+ }
+
+ int onload()
+ {
+ OnAttachEvent();
+
+ m_Edit = GetControl("Txt");
+
+ m_Html = GetControl("note");
+
+ m_cb = GetControl("attlist");
+
+ m_EntityID = "";
+ m_EntityType = "";
+ m_EntityConnect = "";
+ m_ConnectID = "";
+
+ if (this.GetParam())
+ {
+ //xaserverarg arg = new xaserverarg;
+ //arg.setNativePointer(GetParam());
+ xaserverarg arg = GetParam();
+ m_EntityID = arg.GetArgString("EntityID");
+ m_EntityType = arg.GetArgString("m_EntityType");
+ m_EntityConnect = arg.GetArgString("m_EntityConnect");
+ }
+ Init();
+
+ return 1;
+ }
+ };
+]
\ No newline at end of file
--
Gitblit v1.9.3