| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | #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/ximageview.hpp> |
| | | |
| | | unit trade |
| | | [ |
| | | class SKUProductPictureView3 : public frame |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) SKUProductPictureView3 : public xframe |
| | | { |
| | | imageview im; |
| | | public: |
| | | ximageview im; |
| | | xml doc; |
| | | int m_winHwnd; |
| | | int ParentHWND; |
| | | |
| | | int hiddenBox(string name, bool f) |
| | | HWND m_winHwnd; |
| | | HWND ParentHWND; |
| | | public: |
| | | SKUProductPictureView3(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static SKUProductPictureView3* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SKUProductPictureView3* pWin = new SKUProductPictureView3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int hiddenBox(xstring name, bool f) |
| | | { |
| | | //xnode anode = GetAgentNode(name); |
| | | xnode anode = GetAgentNode(name); |
| | | int LayerFlow_None = 0x00000001; |
| | | int LayerFlow_UnLayer = 0x00000100; |
| | | int LayerFlow_NS = 0x00000004; |
| | | int LayerFlow_WE = 0x00000008; |
| | | int LayerFlow_Control = 0x00000010; |
| | | int LayerFlow_None_ = 0x00000001; |
| | | int LayerFlow_UnLayer_ = 0x00000100; |
| | | int LayerFlow_NS_ = 0x00000004; |
| | | int LayerFlow_WE_ = 0x00000008; |
| | | int LayerFlow_Control_ = 0x00000010; |
| | | if (f) |
| | | anode.SetLayerFlow(LayerFlow_WE | LayerFlow_Control); |
| | | anode.SetLayerFlow(LayerFlow_WE_ | LayerFlow_Control_); |
| | | else |
| | | anode.SetLayerFlow(LayerFlow_None | LayerFlow_UnLayer); |
| | | anode.SetLayerFlow(LayerFlow_None_ | LayerFlow_UnLayer_); |
| | | return 1; |
| | | } |
| | | |
| | | int OnImgDBClicked(ref TNotifyEvent evt, int pr) |
| | | int OnImgDBClicked(TEvent* evt, int pr) |
| | | { |
| | | ref IMGNNMHDR nmtv = evt.pnmh; |
| | | string src = nmtv.path; |
| | | IMGNNMHDR& nmtv = *(IMGNNMHDR*)evt->notify.pnmh; |
| | | xstring src = nmtv.path; |
| | | /*if(src.length() > 60) |
| | | src = src.right(44); |
| | | else |
| | | src=src.mid(src.find("Thumbs", 0)+6, 50); |
| | | src=src.mid(src.find(L"Thumbs", 0)+6, 50); |
| | | */ |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //arg.AddArg("src","/business/products/chanpin"+src); |
| | | arg.AddArg("src", src); |
| | | xaserverarg arg; |
| | | |
| | | //arg.AddArg(L"src",L"/business/products/chanpin"+src); |
| | | arg.AddArg(L"src", src); |
| | | |
| | | //win::OpenWindow("dev:xpage[BigPicture.vx]",arg); |
| | | //win::OpenWindow(L"dev:xpage[BigPicture.vx]",arg); |
| | | |
| | | int h = openUrl("/sale/view/ProductLibrary/xpage/bigpictureview", arg); |
| | | int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", arg); |
| | | return 1; |
| | | |
| | | xwin x = new xwin; |
| | | /*xwin x = new xwin; |
| | | x.setNativePointer(h); |
| | | m_winHwnd = x.GetHWND(); |
| | | |
| | | string sh = doc.GetXml(); |
| | | xstring sh = doc.xml(); |
| | | int p = cast(sh as int); |
| | | win32::SendMessage(m_winHwnd, 0x401, p, 0); |
| | | return 1; |
| | | return 1;*/ |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == "xmSave") |
| | | if (comdid == L"xmSave") |
| | | { |
| | | string x = " ".space(256); |
| | | xutil::OpenDialog(this.GetHWND(), x); |
| | | if (x == "") return 0; |
| | | xstring x = L" "; |
| | | xutil::OpenDialog(GetHWND(), x); |
| | | if (x == L"") return 0; |
| | | |
| | | msxml::IXMLDOMElement e = doc.GetXmlDoc().selectSingleNode("ImageList"); |
| | | msxml::IXMLDOMNodeList nlist = e.SelectNodes("image"); |
| | | KXMLDOMElement e = doc.selectSingleNode(L"ImageList"); |
| | | KXMLDOMNodeList nlist = e.selectNodes(L"image"); |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | int s = nlist.length; |
| | | string result = ""; |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | int s = nlist.length(); |
| | | xstring result = L""; |
| | | for (int i = 0; i < s; i++) |
| | | { |
| | | msxml::IXMLDOMElement xitem = nlist.item(i); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | if (picname == "") continue; |
| | | string goodsno = xitem.selectSingleNode("GoodsNo").text; |
| | | string src = picname.mid(26, picname.length()); |
| | | //trace(picname + "-->" + src + "\r\n"); |
| | | if (src == "" || src == "/") continue; |
| | | int openRet = xaserver::DownLoadFile(GetServerUrl(), "/business/products/chanpin/" + src, "", x + "/" + goodsno + ".jpg"); |
| | | KXMLDOMElement xitem = nlist.item(i); |
| | | xstring picname = xitem.selectSingleNode(L"PicPath").text(); |
| | | if (picname == L"") continue; |
| | | xstring goodsno = xitem.selectSingleNode(L"GoodsNo").text(); |
| | | xstring src = picname.mid(26, picname.length()); |
| | | //trace(picname + L"-->" + src + L"\r\n"); |
| | | if (src == L"" || src == L"/") continue; |
| | | int openRet = xaserver::DownLoadFile(GetServerUrl(), L"/business/products/chanpin/" + src, L"", x + L"/" + goodsno + L".jpg"); |
| | | if (openRet < 0) |
| | | { |
| | | //trace(picname + "-->" + src + "\r\n"); |
| | | result += goodsno + " "; |
| | | //trace(picname + L"-->" + src + L"\r\n"); |
| | | result += goodsno + L" "; |
| | | } |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | if (result != "") |
| | | alert(result + "\r\n以上货号下载图片失败!"); |
| | | if (result != L"") |
| | | alert(result + L"\r\n以上货号下载图片失败!"); |
| | | else |
| | | alert("保存完毕!"); |
| | | alert(L"保存完毕!"); |
| | | } |
| | | else if (comdid == "xmDelete") |
| | | else if (comdid == L"xmDelete") |
| | | { |
| | | int hh = ParentHWND; |
| | | if (hh > 0) |
| | | if (ParentHWND) |
| | | { |
| | | int nIndex = im.GetSelectIndex(); |
| | | if (nIndex < 0 || nIndex >= im.GetImageCount()) return 0; |
| | | im.RemoveImage(nIndex); |
| | | im.Redraw(); |
| | | string comd = "Delete:" + nIndex.toString(); |
| | | win32::SendMessage(hh, 0x401, comd, 0); |
| | | xstring comd = L"Delete:" +xstring(nIndex); |
| | | SendMessage(ParentHWND, 0x401, (WPARAM)comd.c_str(), 0); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | int OnXCommand(TEvent* evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnCombboChange(ref TCommandEvent evt, int lParam) |
| | | int OnCombboChange(TEvent* evt, int lParam) |
| | | { |
| | | xcombobox xc = GetControl("precent"); |
| | | string text = xcombobox::GetLBText(xc.GetId()); |
| | | xcombobox xc = GetControl(L"precent"); |
| | | xstring text = xc.GetLBText(); |
| | | int p = text.toInt(); |
| | | if (p == 0) p = 100; |
| | | im.Preview(p); |
| | |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("im1", "IMG_LDBCLICK", OnImgDBClicked); |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | AttachEvent("precent", "CBN_SELCHANGE", OnCombboChange); |
| | | AttachEvent(L"im1", L"IMG_LDBCLICK", (FEvent)&SKUProductPictureView3::OnImgDBClicked); |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&SKUProductPictureView3::OnXCommand); |
| | | AttachEvent(L"precent", L"CBN_SELCHANGE", (FEvent)&SKUProductPictureView3::OnCombboChange); |
| | | return 1; |
| | | } |
| | | |
| | | int init() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | if (this.GetParam()) |
| | | arg = this.GetParam(); |
| | | if (GetWinParam()) |
| | | arg = GetArg(); |
| | | else |
| | | return 0; |
| | | |
| | | if (url::get(GetEntityName(1) + "/pref/category/picture/list", arg.GetString(), x) != 1) |
| | | if (xurl::get(GetEntityName(1) + L"/pref/category/picture/list", arg.GetString(), x) != 1) |
| | | { |
| | | trace("xxx", x.GetXml()); |
| | | trace(L"error:" + xstring(x.xml(), true)); |
| | | return 0; |
| | | } |
| | | //trace(arg.GetString()); |
| | |
| | | |
| | | int onload() |
| | | { |
| | | im = GetControl("im1"); |
| | | SetArg(); |
| | | im = GetControl(L"im1"); |
| | | OnAttachEvent(); |
| | | |
| | | ParentHWND = 0; |
| | | |
| | | if (this.GetParam()) |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | //arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | string hh = arg.GetArgString("ParentHWND"); |
| | | ParentHWND = hh.toInt(); |
| | | string openflag = arg.GetArgString("OpenFlag"); |
| | | xaserverarg arg = GetArg(); |
| | | ParentHWND = (HWND)arg.GetParam(L"ParentHWND"); |
| | | xstring openflag = arg.GetArgString(L"OpenFlag"); |
| | | //alert(openflag); |
| | | if (openflag != "0") hiddenBox("xmDelete", false); |
| | | if (openflag != L"0") hiddenBox(L"xmDelete", false); |
| | | //trace(arg.GetString()); |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xml x ; |
| | | |
| | | //alert(arg.GetString()); |
| | | //if(url::get("/sale/data/product/pref/category/picture/list",arg.GetString(),x)!=1) |
| | | if (url::get("/sale/data/ProductLibrary3/pref/picture/imagelistSKUNoList", arg.GetString(), x) != 1) |
| | | //if(url::get(L"/sale/data/product/pref/category/picture/list",arg.GetString(),x)!=1) |
| | | if (xurl::get(L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNoList", arg.GetString(), x) != 1) |
| | | { |
| | | trace("xxx", x.GetXml()); |
| | | trace(L"error:" + xstring(x.xml(), true)); |
| | | return 0; |
| | | } |
| | | doc = x; |
| | | //alert(x.GetXml()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().selectSingleNode("ImageList"); |
| | | msxml::IXMLDOMNodeList nlist = e.SelectNodes("image"); |
| | | //alert(x.xml()); |
| | | KXMLDOMElement e = x.selectSingleNode(L"ImageList"); |
| | | KXMLDOMNodeList nlist = e.selectNodes(L"image"); |
| | | int i; |
| | | int s = nlist.length; |
| | | int s = nlist.length(); |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | msxml::IXMLDOMElement xitem = nlist.item(i); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | string goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | //trace(picname + "\r\n"); |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | KXMLDOMElement xitem = nlist.item(i); |
| | | xstring picname = xitem.selectSingleNode(L"PicPath").text(); |
| | | xstring goodno = xitem.selectSingleNode(L"GoodsNo").text(); |
| | | //trace(picname + L"\r\n"); |
| | | if (picname == L"/business/products/Thumbs//") |
| | | picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, goodno); |
| | | } |
| | | im.Redraw(); |
| | | } |
| | | else { |
| | | im.AddImages("/business/products/chanpin/BL-002/291679.jpg", "x1"); |
| | | im.AddImages("/business/products/chanpin/BL-002/291759.jpg", "x2"); |
| | | im.AddImages("/business/products/chanpin/BL-002/417884.jpg", "x3"); |
| | | im.AddImages(L"/business/products/chanpin/BL-002/291679.jpg", L"x1"); |
| | | im.AddImages(L"/business/products/chanpin/BL-002/291759.jpg", L"x2"); |
| | | im.AddImages(L"/business/products/chanpin/BL-002/417884.jpg", L"x3"); |
| | | im.Redraw(); |
| | | } |
| | | win32::SetFocus(im.GetId()); |
| | | SetFocus(im.GetHWND()); |
| | | |
| | | string userno = xaserver::GetUserNo(); |
| | | /*if(userno == "1003" || userno == "1137" || userno == "admin") { |
| | | xstring userno = xaserver::GetUserNo(); |
| | | /*if(userno == L"1003" || userno == L"1137" || userno == L"admin") { |
| | | //hiddenBox(); |
| | | } else { |
| | | hiddenBox("xmSave", false); |
| | | hiddenBox(L"xmSave", false); |
| | | }*/ |
| | | hiddenBox("xmSave", false); |
| | | hiddenBox(L"xmSave", false); |
| | | |
| | | return -1; |
| | | } |
| | | }; |
| | | ] |
| | | }; |