| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <wobject/xdouble.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <xcontrol/ximageview.hpp> |
| | | |
| | | #include "vbusiness/vframe/maint.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | #include "viewobject/saleorder.view.hpp" |
| | | #include "viewobject/quote.view.hpp" |
| | | #include "viewobject/shoppingcart.view.hpp" |
| | | #include "viewobject/productLibrary.view.hpp" |
| | | #include "xcontrol/xcheckbox.hpp" |
| | | #include "xcontrol/xshtml.hpp" |
| | | |
| | | class __declspec(dllexport) ProductLibrary4Win : public xframe |
| | | { |
| | | public: |
| | | //产ååºäº§åå表 |
| | | xdwgrid dw_list; |
| | | //è´ç©è½¦äº§åå表 |
| | | xdwgrid dwc_list; |
| | | |
| | | //产åç¼å对象 |
| | | xdataset g_xdoc_product; |
| | | xdataset g_xdoc_shoppingcart; |
| | | |
| | | xcombobox cbx_goodscar; |
| | | //æ¯å¦å¤é |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | xtreeview tv_folder; |
| | | xstring agentFor; |
| | | KXMLDOMElement imageElement; |
| | | xstring m_customer; |
| | | |
| | | public: |
| | | int FillGoodsCarList() |
| | | { |
| | | xcombobox xc = GetControl(L"frame:cbx_goodscar"); |
| | | if (!xc) return 0; |
| | | xml x = ShoppingCartView::GetRoleList(); |
| | | if (!x) return 0; |
| | | xc.SetText(L"==éæ©è´ç©è½¦==L"); |
| | | |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"//item"); |
| | | int len = nlist.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = nlist.item(i); |
| | | xstring name = e.getAttribute(L"name"); |
| | | xc.AddItem( name); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | 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"[@for='" + agentFor + L"']/*"); |
| | | if (agent) |
| | | { |
| | | bstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | //FillGoodsCarList(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent * evt, int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | KXMLDOMElement OnGetCarListRowElement(int row = 0) |
| | | { |
| | | if (row < 1) row = dwc_list.GetRow(); |
| | | if (row < 1 || row > dwc_list.GetRowCount()) return 0; |
| | | KXMLDOMElement e = g_xdoc_shoppingcart.getRowElement(L"data/Item", row); |
| | | return e; |
| | | } |
| | | |
| | | int OnShowImage(xstring skuid) |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | //im.RemoveImage(); |
| | | im.Reset(); |
| | | |
| | | xml xp ; |
| | | xaserverarg arg_pic; |
| | | arg_pic.AddArg(L"SKUID", skuid); |
| | | if (xurl::get(L"/sale/data/ProductLibrary3/pref/picture/imagelistSKU", arg_pic.GetString(), xp) != 1) |
| | | { |
| | | trace(xstring(L"xxx")+xp.xml()); |
| | | } |
| | | else |
| | | { |
| | | //trace(skuid+L" "+xp.GetXml()); |
| | | imageElement = xp.documentElement(); |
| | | KXMLDOMNodeList nlistp = xp.selectNodes(L"ImageList/image"); |
| | | int lenp = nlistp.length(); |
| | | for (int ip = 0; ip < lenp; ip++) |
| | | { |
| | | KXMLDOMElement xitem = nlistp.item(ip); |
| | | xstring picname = xitem.selectSingleNode(L"PicPath").text(); |
| | | xstring goodno = xitem.selectSingleNode(L"GoodsNo").text(); |
| | | if (picname == L"/business/products/Thumbs//") |
| | | picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, (LPTSTR)L""); |
| | | } |
| | | im.Redraw(); |
| | | //win32::SendMessage(im.GetId(),0x000f,0,1); |
| | | //win32::InvalidateRect(im.GetId(),cast(0 as ref xrect),true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnShowImage(xstring skuid, xstring customerItemNo) |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | //im.RemoveImage(); |
| | | im.Reset(); |
| | | |
| | | xml xp ; |
| | | xaserverarg arg_pic ; |
| | | arg_pic.AddArg(L"SKUID", skuid); |
| | | arg_pic.AddArg(L"CustomerID", m_customer); |
| | | arg_pic.AddArg(L"CustomerItemNo", customerItemNo); |
| | | |
| | | if (xurl::get(L"/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKU", arg_pic.GetString(), xp) != 1) |
| | | { |
| | | trace(L"error:" + xstring(xp.xml(),true)); |
| | | } |
| | | else |
| | | { |
| | | imageElement = xp.documentElement(); |
| | | KXMLDOMNodeList nlistp = xp.selectNodes(L"ImageList/image"); |
| | | int lenp = nlistp.length(); |
| | | for (int ip = 0; ip < lenp; ip++) |
| | | { |
| | | KXMLDOMElement xitem = nlistp.item(ip); |
| | | bstring picname = xitem.selectSingleNode(L"PicPath").text(); |
| | | bstring goodno = xitem.selectSingleNode(L"GoodsNo").text(); |
| | | if (picname == L"/business/products/Thumbs//") |
| | | picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, L""); |
| | | } |
| | | im.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent * evt, int p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | xshtml 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); |
| | | trace(id); |
| | | return 1; |
| | | } |
| | | |
| | | int OnGoodsCarRowChanged(TEvent * evt, int p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | xstring html = makeGoodscarHtml(row); |
| | | xs.SetContent(html); |
| | | xs.Redraw(); |
| | | if (m_customer) |
| | | { |
| | | xstring id = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); |
| | | xstring customerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); |
| | | OnShowImage(id, customerItemNo); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int DeleteRow(int row) |
| | | { |
| | | int IDOK = 1; |
| | | int MB_OKCANCEL = 1; |
| | | int MB_ICONQUESTION = 32; |
| | | if (MessageBoxW(GetHWND(), L"确认å 餿å®ç项ï¼å é¤åå°ä¸è½æ¢å¤?", L"æç¤º", MB_OKCANCEL | MB_ICONQUESTION) != IDOK) return 1; |
| | | xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); |
| | | |
| | | if (ProductLibraryView::DeleteItem(id) == 1) dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int SetSelectState(xdwgrid dw_obj, int state) |
| | | { |
| | | if (state == 1) |
| | | { |
| | | dw_obj.SetSelectionMode(3); |
| | | } |
| | | else if (state == -1) |
| | | { |
| | | dw_obj.SelectRow(0, false); |
| | | dw_obj.SetSelectionMode(0); |
| | | } |
| | | return 1; |
| | | } |
| | | int OnCkbCLick(TEvent * evt, int p) |
| | | { |
| | | xcheckbox cbx_1 = GetControl(L"frame:cbx1"); |
| | | int state = cbx_1.GetCheck(); |
| | | return SetSelectState(dw_list, state); |
| | | } |
| | | |
| | | int OnCkbCLick2(TEvent * evt, int p) |
| | | { |
| | | xcheckbox cbx_2 = GetControl(L"frame:cbx2"); |
| | | int state = cbx_2.GetCheck(); |
| | | return SetSelectState(dwc_list, state); |
| | | } |
| | | |
| | | xml GetGoodsPropList(xstring guid) |
| | | { |
| | | xml x; |
| | | xaserverarg arg; |
| | | arg.AddArg(L"guid", guid); |
| | | if (xurl::get(L"/sale/data/SO/goods/goodsprop/list", arg.GetString(), x) != 1) |
| | | { |
| | | bstring error = x.text(); |
| | | alert(error); |
| | | } |
| | | return x; |
| | | } |
| | | |
| | | xml GetGoodsPropListEx(xstring guid) |
| | | { |
| | | xml x; |
| | | xstring fields = L"<data>"; |
| | | //fields +=L"<field name='HighestPrice' label='æé«ä»·'/>"; |
| | | //fields +=L"<field name='LowestPrice' label='æä½ä»·'/>"; |
| | | |
| | | //fields +=L"<field name='BulkPrice' label='æ£è´§ä»·'/>"; |
| | | //fields +=L"<field name='CardPrice' label='纸å¡ä»·'/>"; |
| | | //fields +=L"<field name='BuyPrice' label='éè´ä»·'/>"; |
| | | //fields +=L"<field name='SupplierID' label='è´§æº'/>"; |
| | | |
| | | fields += L"<field name='Packing' label='å
è£
æ¹å¼'/>"; |
| | | fields += L"<field name='PackingRate' label='æ¯ç®±æ°é'/>"; |
| | | fields += L"<field name='VolumeDesc' label='å
è£
å°ºç '/>"; |
| | | fields += L"<field name='GWPerPkg' label='æ¯é'/>"; |
| | | fields += L"<field name='NWPerPkg' label='åé'/>"; |
| | | //fields +=L"<field name='DeveloperID' label='å¼å人å'/>"; |
| | | fields += L"<field name='AttributeValue_1' label='产å屿§'/>"; |
| | | //fields +=L"<field name='Remark' label='夿³¨'/>"; |
| | | |
| | | fields += L"</data>"; |
| | | x.loadXML(fields); |
| | | |
| | | return x; |
| | | } |
| | | |
| | | 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") + |
| | | L"</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") + |
| | | L"</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") + |
| | | L"</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") + |
| | | L"</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") + |
| | | L"</span></div>"; |
| | | |
| | | KXMLDOMNodeList fieldsEx = x1.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 += (xstring)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 (xstring(options.item(k).text())) |
| | | { |
| | | if (k > 0) terms += L", L"; |
| | | terms += (xstring)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 += (xstring)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; |
| | | |
| | | //æ¾ç¤ºå¾ç |
| | | /* |
| | | if (id != L"") |
| | | { |
| | | xml xp=new xml; |
| | | xp.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg_pic=new xaserverarg; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg(L"SKUID",id); |
| | | if(url::get(L"/sale/data/ProductLibrary3/pref/picture/imagelistSKU",arg_pic.GetString(),xp)!=1) |
| | | { |
| | | trace(L"xxx",xp.GetXml()); |
| | | }else { |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >ͼƬ:</span>" ; |
| | | KXMLDOMElement ep= xp.selectSingleNode(L"ImageList"); |
| | | if (ep) |
| | | { |
| | | if (ep.SelectNodes(L"image")){ |
| | | KXMLDOMNodeList nlistp = ep.SelectNodes(L"image"); |
| | | int ip=0; |
| | | int lenp = nlistp.length; |
| | | for(ip=0;ip<lenp;ip++) |
| | | { |
| | | KXMLDOMElement xitemp = nlistp.item(ip); |
| | | xstring filename = xitemp.selectSingleNode(L"PicPath").text; |
| | | //trace(filename); |
| | | html += L"<control visible='layer' controlclass='ximage' data='' src='http://192.168.7.241:7001" + filename +L"'/>"; |
| | | } |
| | | } |
| | | } |
| | | html += L"</div>"; |
| | | } |
| | | }else { |
| | | xstring picname = L"1FA9E331-F95C-4E51-B80C-73FB9B911D8D.jpg";//dw_list.GetItemString(row,L"ImgName"); //ItemID+L".jpg"; |
| | | xstring str = picname.mid(0,2); |
| | | str = str.upper(); |
| | | xstring serversrc =L"http://192.168.7.241:1001/business/products/chanpin/"+str+L"/"+picname; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >ͼƬ:</span>"; |
| | | html += L"<control visible='layer' controlclass='ximage' data='' src='"+ serversrc +L"'/></div>"; |
| | | } |
| | | */ |
| | | html += L"</body></html>"; |
| | | //trace(html); |
| | | return html; |
| | | } |
| | | |
| | | xstring makeGoodscarHtml(int row) |
| | | { |
| | | xstring No = dwc_list.GetItemString(row, L"RefNo");//è·å屿§å¼id |
| | | xml x = GetGoodsPropList(No); |
| | | |
| | | xstring html = L"<html><style> .text{ font-weight:400} .label { font-weight:400;}</style><body style='margin:2;background-color1:#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'>" + dwc_list.GetItemString(row, L"No") + |
| | | L"</span></div>"; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >åå:</span><span style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row, L"CName") + |
| | | L"</span></div>"; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >è§æ ¼:</span><span style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row, L"CSpec") + |
| | | L"</span></div>"; |
| | | |
| | | KXMLDOMNodeList fields = x.selectNodes(L"data/field"); |
| | | int len = fields.length(); |
| | | html += (xstring)L"<table>" + |
| | | L"<colgroup span='1' width='80'/>" + |
| | | L"<colgroup span='1' width='120'/>" + |
| | | L"<colgroup span='1' width='420'/>"; |
| | | html += L"<tr>"; |
| | | html += L"<td style='text-align:center'>ç¼å·</td><td style='text-align:center'>项ç®</td><td style='text-align:center'>å
容</td>"; |
| | | html += L"</tr>"; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | xstring name = fields.item(i).selectSingleNode(L"@name").text(); |
| | | xstring label = fields.item(i).selectSingleNode(L"@label").text(); |
| | | html += L"<tr>"; |
| | | if (i == 0) |
| | | html += L"<td rowspan='" + xstring(len) + L"'>" + No + L"</td><td >" + label + L"</td><td >" + L"</td>"; |
| | | else |
| | | html += L"<td >" + label + L"</td><td >" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, name) + L"</td>"; |
| | | html += L"</tr>"; |
| | | } |
| | | |
| | | html += L"<tr>"; |
| | | html += L"<td rowspan='3'>" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"PackCode") + L"</td><td >å
è£
æ¹å¼</td><td >" + |
| | | g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CPack") + L"</td>"; |
| | | html += L"</tr>"; |
| | | html += L"<tr height='48'>"; |
| | | html += L"<td >å
è£
è¦æ±</td><td >" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"PackQualityTerm") + L"</td>"; |
| | | html += L"</tr>"; |
| | | html += L"<tr>"; |
| | | html += L"<td >ä¾§å</td><td ></td>"; |
| | | html += L"</tr>"; |
| | | |
| | | html += L"<tr height='72'>"; |
| | | html += L"<td>" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"QualityCode") + L"</td><td >è´¨éè¦æ±</td><td >" + |
| | | g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"QualityTerm") + L"</td>"; |
| | | html += L"</tr>"; |
| | | |
| | | html += L"</table>"; |
| | | |
| | | html += L"</body></html>"; |
| | | return html; |
| | | |
| | | } |
| | | |
| | | int CarGoodsDelete() |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | xstring Up(xstring name) { |
| | | xstring str = name.mid(0, 2); |
| | | str = str.toUpper(); |
| | | return xaserver::UploadFile(L"product" + str, name + L".jpg", this.GetHWND(), L"", false); |
| | | } |
| | | |
| | | int OnAddImage() { |
| | | if (m_customer != L"") return OnAddImageEx(); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dw_list.GetRow(); |
| | | if (row < 1 || row > dw_list.GetRowCount()) return 0; |
| | | |
| | | KXMLDOMElement e = g_xdoc_product.getRowElement(L"data/Item", row); |
| | | xstring skuid = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); |
| | | xstring SKUNo = g_xdoc_product.getData(0, L"data/Item", row, L"SKUNo"); |
| | | xstring id = ViewObject::GetGuid(); |
| | | xstring ret1 = Up(id); |
| | | if (ret1 == L"-1") return -1; |
| | | if (ret1 == L"0") |
| | | { |
| | | alert(L"ä¸ä¼ å¾ç失败"); |
| | | return -1; |
| | | } |
| | | xstring originfile = ret1; |
| | | xstring ext = originfile.right(7); |
| | | if (ext.find(L".") >= 0) |
| | | ext = ext.mid(ext.find(L".") + 1, 9999); |
| | | else |
| | | ext = L"jpg"; |
| | | |
| | | // å¾çåå å
¥æ°æ®åº |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | x.LoadXml(L"<Item update.new='1' update.modify='1' guid='" + id + L"'>" + |
| | | "<ProductPictureID>" + id + L"</ProductPictureID>" + |
| | | "<OriginFile>" + originfile + L"</OriginFile>" + |
| | | "<FileExt>" + ext + L"</FileExt>" + |
| | | "<SKUID>" + skuid + L"</SKUID>" + |
| | | "<Name>[" + SKUNo.trim() + L"]</Name>" + |
| | | "<FileName>" + id + L".jpg</FileName>" + |
| | | "</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"content", x.GetXml()); |
| | | if (url::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text); |
| | | return -1; |
| | | } |
| | | dw_list.SetItemString(row, L"pic", L"*"); |
| | | dw_list.Redraw(); |
| | | //å·æ°ä¸ä¸çé¢ï¼æ¾ç¤ºå¾ç |
| | | OnShowImage(skuid); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddImageEx() { |
| | | int row = dwc_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dwc_list.GetRow(); |
| | | if (row < 1 || row > dwc_list.GetRowCount()) return 0; |
| | | |
| | | KXMLDOMElement e = g_xdoc_shoppingcart.getRowElement(L"data/Item", row); |
| | | xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); |
| | | xstring SKUNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID/@__displaystring"); |
| | | xstring CustomerID = m_customer; |
| | | xstring CustomerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); |
| | | xstring id = ViewObject::GetGuid(); |
| | | xstring ret1 = Up(id); |
| | | if (ret1 == L"-1") return -1; |
| | | if (ret1 == L"0") |
| | | { |
| | | alert(L"ä¸ä¼ å¾ç失败"); |
| | | return -1; |
| | | } |
| | | xstring originfile = ret1; |
| | | xstring ext = originfile.right(7); |
| | | if (ext.find(L".") >= 0) |
| | | ext = ext.mid(ext.find(L".") + 1, 9999); |
| | | else |
| | | ext = L"jpg"; |
| | | |
| | | // å¾çåå å
¥æ°æ®åº |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | x.LoadXml(L"<Item update.new='1' update.modify='1' guid='" + id + L"'>" + |
| | | "<ProductPictureID>" + id + L"</ProductPictureID>" + |
| | | "<OriginFile>" + originfile + L"</OriginFile>" + |
| | | "<FileExt>" + ext + L"</FileExt>" + |
| | | "<SKUID>" + skuid + L"</SKUID>" + |
| | | "<CustomerItemNo>" + CustomerItemNo + L"</CustomerItemNo>" + |
| | | "<CustomerID>" + CustomerID + L"</CustomerID>" + |
| | | "<Name>[" + SKUNo.trim() + L"]</Name>" + |
| | | "<FileName>" + id + L".jpg</FileName>" + |
| | | "</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"content", x.GetXml()); |
| | | if (url::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text); |
| | | return -1; |
| | | } |
| | | dwc_list.SetItemString(row, L"pic", L"*"); |
| | | dwc_list.Redraw(); |
| | | //å·æ°ä¸ä¸çé¢ï¼æ¾ç¤ºå¾ç |
| | | OnShowImage(skuid, CustomerItemNo); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteImageEx() |
| | | { |
| | | int row = dwc_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dwc_list.GetRow(); |
| | | if (row < 1 || row > dwc_list.GetRowCount()) return 0; |
| | | |
| | | ximageview im = GetControl(L"im1"); |
| | | int index = im.GetSelectIndex(); |
| | | int count = im.GetImageCount(); |
| | | |
| | | if (count < 1) return 1; |
| | | |
| | | KXMLDOMNodeList images = imageElement.selectNodes(L"image"); |
| | | int length = images.length; |
| | | if (length < index) return 1; |
| | | |
| | | int MB_OKCANCEL = 0x00000001; |
| | | int IDOK = 1; |
| | | if (win32::MessageBox(GetHWND(), L"确认å é¤å½åå¾ç?", L"æç¤º", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | xstring id = images.item(index).selectSingleNode(L"@guid").text; |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; |
| | | arg.AddArg(L"content", str); |
| | | if (url::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text); |
| | | return -1; |
| | | } |
| | | if (count == 1) |
| | | { |
| | | dwc_list.SetItemString(row, L"pic", L""); |
| | | dwc_list.Redraw(); |
| | | } |
| | | |
| | | xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); |
| | | xstring SKUNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID/@__displaystring"); |
| | | xstring CustomerID = m_customer; |
| | | xstring CustomerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); |
| | | OnShowImage(skuid, CustomerItemNo); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteImage() { |
| | | if (m_customer != L"") return OnDeleteImageEx(); |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dw_list.GetRow(); |
| | | if (row < 1 || row > dw_list.GetRowCount()) return 0; |
| | | |
| | | ximageview im = GetControl(L"im1"); |
| | | int index = im.GetSelectIndex(); |
| | | int count = im.GetImageCount(); |
| | | |
| | | if (count < 1) return 1; |
| | | |
| | | KXMLDOMNodeList images = imageElement.selectNodes(L"image"); |
| | | int length = images.length; |
| | | if (length < index) return 1; |
| | | |
| | | int MB_OKCANCEL = 0x00000001; |
| | | int IDOK = 1; |
| | | if (win32::MessageBox(GetHWND(), L"确认å é¤å½åå¾ç?", L"æç¤º", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | xstring id = images.item(index).selectSingleNode(L"@guid").text; |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; |
| | | arg.AddArg(L"content", str); |
| | | if (url::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text); |
| | | return -1; |
| | | } |
| | | if (count == 1) |
| | | { |
| | | dw_list.SetItemString(row, L"pic", L""); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | KXMLDOMElement e1 = g_xdoc_product.getRowElement(L"data/Item", row); |
| | | xstring skuid = e1.getAttribute(L"guid"); |
| | | OnShowImage(skuid); |
| | | |
| | | return 1; |
| | | } |
| | | int OnPreviewImage() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dw_list.GetRow(); |
| | | if (row < 1 || row > dw_list.GetRowCount()) return 0; |
| | | KXMLDOMElement e = g_xdoc_product.getRowElement(L"data/Item", row); |
| | | //KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | //alert(e.xml); |
| | | xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); |
| | | //alert(id); |
| | | |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | xstring categoryid = e1.selectSingleNode(L"@guid").text; |
| | | //alert(categoryid); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"SKUID", id); |
| | | arg.AddArg(L"CategoryID", categoryid); |
| | | |
| | | |
| | | int pr = trust(arg as int); //g_xdoc_product |
| | | OpenWindow(L"dev:xpage[PictureView.Product3.vx]", pr); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ItemMaint() |
| | | { |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | //xstring no = e.getAttribute(L"no"); |
| | | //if(no==L"") return 1; |
| | | xstring guid = e.getAttribute(L"guid"); |
| | | if (guid == L"") return 1; |
| | | |
| | | /* |
| | | if(no==L"NP0000FS" || no==L"UP0000FS") |
| | | { |
| | | OpenWindow(L"dev:xpage[PackSchemaMaint.goodslib.vx]"); |
| | | }else |
| | | { |
| | | int pr = g_xdoc_product; |
| | | OpenWindow(L"dev:xpage[ProductLibraryItemMaint.vx]",pr); |
| | | } |
| | | */ |
| | | //KXMLDOMElement ele = g_xdoc_product.getRowElement(L"data/Item", 1); |
| | | //alert(ele.xml); |
| | | |
| | | int pr = g_xdoc_product; |
| | | OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", pr); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ItemAdd() |
| | | { |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | //alert(e.xml); |
| | | /*xstring no = e.getAttribute(L"no"); |
| | | if(no==L"") return 1; |
| | | if(no==L"NP0000FS" || no==L"UP0000FS") |
| | | { |
| | | OpenWindow(L"dev:xpage[PackSchemaMaint.goodslib.vx]"); |
| | | }else |
| | | { |
| | | int p = no; |
| | | OpenWindow(L"dev:xpage[SO.autolist.goodslib.add.vx]",p); |
| | | }*/ |
| | | xstring guid = e.getAttribute(L"guid"); |
| | | if (guid == L"") return 1; |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", e.getAttribute(L"guid")); |
| | | if (name == L"个人产å") |
| | | arg.AddArg(L"FolderID", e.getAttribute(L"guid")); |
| | | else |
| | | arg.AddArg(L"CategoryID", e.getAttribute(L"guid")); |
| | | xstring No = e.getAttribute(L"CategoryNo"); |
| | | if (No == L"") No = e.getAttribute(L"no"); |
| | | xstring Name = e.getAttribute(L"CName"); |
| | | if (Name == L"") Name = e.getAttribute(L"cname"); |
| | | arg.AddArg(L"No", No); |
| | | arg.AddArg(L"CName", Name); |
| | | int p = arg; |
| | | OpenWindow(L"dev:xpage[Quick.Input.NewProduct.vx]", p); |
| | | |
| | | if (arg.GetArgString(L"data.modify") == L"1")RetrieveData(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddFolder() |
| | | { |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | if (hItem != hTopItem) |
| | | { |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | xstring folder = e.getAttribute(L"guid"); |
| | | if (folder != L"") |
| | | { |
| | | arg.AddArg(L"parentCategoryID", folder); |
| | | OpenWindow(L"dev:xpage[UserFolderMaint.vx]", cast(arg as int)); |
| | | /*if(arg.GetArgString(L"FolderID")!=L"") |
| | | { |
| | | int child = tv_folder.GetChildItem(hItem); |
| | | if(!child) |
| | | { |
| | | ExpandItem(hItem); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | KXMLDOMElement e2 = e1.cloneNode(0); |
| | | e2. |
| | | } |
| | | }*/ |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnMaintFolder() |
| | | { |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | if (name == L"个人åº" && selectname == L"æ°äº§å" && tv_folder.GetParentItem(hItem) == hTopItem) return 1; |
| | | if (hItem != hTopItem) |
| | | { |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | xstring folder = e.getAttribute(L"guid"); |
| | | if (folder != L"") |
| | | { |
| | | arg.AddArg(L"CategoryID", folder); |
| | | OpenWindow(L"dev:xpage[UserFolderMaint.vx]", cast(arg as int)); |
| | | if (arg.GetArgString(L"label") != L"") |
| | | { |
| | | tv_folder.SetItemLabel(hItem, arg.GetArgString(L"label")); |
| | | } |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | int hCursor; |
| | | xstring name = L""; |
| | | if (comdid == L"xmRefresh") |
| | | { |
| | | return RetrieveData(); |
| | | } |
| | | else if (comdid == L"xmCarGoodsDelete") |
| | | { |
| | | CarGoodsDelete(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmAddFolder") |
| | | { |
| | | return OnAddFolder(); |
| | | } |
| | | else if (comdid == L"xmMaintFolder") |
| | | { |
| | | return OnMaintFolder(); |
| | | } |
| | | else if (comdid == L"xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmCarGoodsMaint") |
| | | { |
| | | OpenWindow(L"dev:xpage[ShoppingCartProductMaint.vx]", trust(g_xdoc_shoppingcart as int)); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmCarMaint") |
| | | { |
| | | OpenWindow(L"dev:xpage[SO.autolist.Shopcar.vx]"); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSaleOrder") |
| | | { |
| | | int rw = dwc_list.GetNextSelectRow(1); |
| | | xstring content = L"<data>"; |
| | | while (rw > 0) |
| | | { |
| | | KXMLDOMElement xe = OnGetCarListRowElement(rw); |
| | | content += xe.xml; |
| | | rw = dwc_list.GetNextSelectRow(rw + 1); |
| | | |
| | | } |
| | | content += L"</data>"; |
| | | xaserverarg carg = new xaserverarg; |
| | | carg.setNativePointer(carg.CreateInstance()); |
| | | carg.AddArg(L"content", content); |
| | | int newArg2 = carg.ptr_native_; |
| | | OpenWindow(L"dev:xpage[SO.Simulation.Import.vx]", newArg2); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmEnquiry") |
| | | { |
| | | rw = dwc_list.GetNextSelectRow(1); |
| | | content = L"<data>"; |
| | | while (rw > 0) |
| | | { |
| | | xe = OnGetCarListRowElement(rw); |
| | | content += xe.xml; |
| | | rw = dwc_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | content += L"</data>"; |
| | | carg = new xaserverarg; |
| | | carg.setNativePointer(carg.CreateInstance()); |
| | | carg.AddArg(L"content", content); |
| | | newArg2 = carg.ptr_native_; |
| | | OpenWindow(L"dev:xpage[Enquiry.Import.vx]", newArg2); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmPurchar") |
| | | { |
| | | rw = dwc_list.GetNextSelectRow(1); |
| | | content = L"<data>"; |
| | | while (rw > 0) |
| | | { |
| | | xe = OnGetCarListRowElement(rw); |
| | | content += xe.xml; |
| | | rw = dwc_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | content += L"</data>"; |
| | | carg = new xaserverarg; |
| | | carg.setNativePointer(carg.CreateInstance()); |
| | | carg.AddArg(L"content", content); |
| | | newArg2 = carg.ptr_native_; |
| | | OpenWindow(L"dev:xpage[PO.Import.vx]", newArg2); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSearch") |
| | | { |
| | | RetrieveData(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmQuote") |
| | | { |
| | | rw = dwc_list.GetNextSelectRow(1); |
| | | content = L"<data>"; |
| | | while (rw > 0) |
| | | { |
| | | xe = OnGetCarListRowElement(rw); |
| | | content += xe.xml; |
| | | rw = dwc_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | content += L"</data>"; |
| | | carg = new xaserverarg; |
| | | carg.setNativePointer(carg.CreateInstance()); |
| | | carg.AddArg(L"content", content); |
| | | newArg2 = carg.ptr_native_; |
| | | OpenWindow(L"dev:xpage[Quote.Import.vx]", newArg2); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmAdd") |
| | | { |
| | | return ItemAdd(); |
| | | } |
| | | else if (comdid == L"xmDelete") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | xstring skuid = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); |
| | | xml skuid_x = ViewObject::RetrieveData(L"/sale/data/ProductLibrary3/ProductNumberone", L"SKUID", skuid); |
| | | xstring skuidEx = skuid_x.text; |
| | | int skuid1 = skuidEx.toInt(); |
| | | if (skuid1) |
| | | { |
| | | if (skuid1 > 0) |
| | | { |
| | | alert(L"订åå·²æäº§åï¼ä¸å
许å é¤ï¼"); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | DeleteRow(row); |
| | | |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmCarAdd") |
| | | { |
| | | hCursor = xutil::SetCursorWait(); |
| | | |
| | | name = GetControl(L"frame:ed_goodscar").GetText(); |
| | | if (name != L"") |
| | | { |
| | | if (ShoppingCartView::AddCar(name) == 1) |
| | | { |
| | | tv_folder.InsertChildItem(LookupTopFolder(tv_folder.GetSelectedItem()), |
| | | name, 0, 35); |
| | | } |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmMaint") |
| | | { |
| | | return ItemMaint(); |
| | | } |
| | | else if (comdid == L"xmAddImage") |
| | | { |
| | | return OnAddImage(); |
| | | } |
| | | else if (comdid == L"xmDeleteImage") |
| | | { |
| | | return OnDeleteImage(); |
| | | } |
| | | else if (comdid == L"xmPreviewImage") |
| | | { |
| | | return OnPreviewImage(); |
| | | } |
| | | else if (comdid == L"xmPropConfigure") |
| | | { |
| | | int r = cast(g_xdoc_product.getData(L"data/Item", L"@guid") as int); |
| | | OpenWindow(L"dev:xpage[Product.ItemProp.Maint.vx]", r); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmRertieve") |
| | | { |
| | | /* |
| | | int hItem1 = tv_folder.GetSelectedItem(); |
| | | KXMLDOMElement e2= tv_folder.GetItemData(hItem1); |
| | | xstring no1 = e2.getAttribute(L"no"); |
| | | xml x2 = vcontrol::RetrieveData(L"/sale/data/SO/goods/usergoods/listex1",L"parent",no1); |
| | | g_xdoc_product.Retrieve(x2); |
| | | */ |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmToCar") |
| | | { |
| | | name = GetControl(L"frame:cbx_goodscar").GetText(); |
| | | if (name == L"==éæ©è´ç©è½¦==L") |
| | | { |
| | | alert(L"è¯·éæ©è´ç©è½¦"); |
| | | return 1; |
| | | } |
| | | int xrow = dw_list.GetNextSelectRow(1); |
| | | xstring goodsid = L""; |
| | | xstring html = L"<data>"; |
| | | while (xrow > 0) |
| | | { |
| | | KXMLDOMElement e = g_xdoc_product.getRowElement(L"data/Item", xrow); |
| | | goodsid = ProductLibraryView::GetElementString(e, L"@guid"); |
| | | html += L"<item goodid='" + goodsid + L"' id ='" + ProductLibraryView::GetGuid() + L"'/>"; |
| | | xrow = dw_list.GetNextSelectRow(xrow + 1); |
| | | } |
| | | html += L"</data>"; |
| | | trace(html); |
| | | if (ShoppingCartView::GoodsImport(name, html) == 1) |
| | | alert(L"æ·»å é误!"); |
| | | else |
| | | alert(L"æ·»å æå"); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | //æ¥æ¾å½åæ 项ç顶级ç®å½ |
| | | int LookupTopFolder(int hItem) |
| | | { |
| | | int hRoot = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); |
| | | return hItem; |
| | | } |
| | | |
| | | //æå
¥äº§å类项çå项 |
| | | int MakeGoodsFolderItem(int hItem, xstring sno) |
| | | { |
| | | xml x = ProductLibraryView::GetTreeChildItems3(sno); |
| | | if (!x) return 0; |
| | | |
| | | KXMLDOMNodeList nlist = x.SelectNodes(L"//Item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = nlist.item(i); |
| | | xstring name = e.getAttribute(L"CName"); |
| | | xstring no = e.getAttribute(L"CategoryNo"); |
| | | xstring label = no.trim() + L" " + name; |
| | | |
| | | int h = tv_folder.InsertChildItem(hItem, label, trust(e as int), 15); |
| | | xstring child = e.getAttribute(L"Childs"); |
| | | if (child == L"") |
| | | tv_folder.SetItemChild(h, 1); |
| | | else if (child != L"0") |
| | | tv_folder.SetItemChild(h, 1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //æå
¥æ°äº§åç®å½å项 |
| | | int MakeUserGoodsFolderItem(int hItem, xstring sno) |
| | | { |
| | | xml x = ProductLibraryView::GetTreeUserChildItems3(sno); |
| | | if (!x) return 0; |
| | | |
| | | KXMLDOMNodeList nlist = x.SelectNodes(L"//Item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = nlist.item(i); |
| | | xstring name = e.getAttribute(L"CName"); |
| | | xstring no = e.getAttribute(L"CategoryNo"); |
| | | xstring label = no.trim() + L" " + name; |
| | | |
| | | int h = tv_folder.InsertChildItem(hItem, label, trust(e as int), 15); |
| | | xstring child = e.getAttribute(L"Childs"); |
| | | if (child == L"") |
| | | tv_folder.SetItemChild(h, 1); |
| | | else if (child != L"0") |
| | | tv_folder.SetItemChild(h, 1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //æå
¥è´ç©è½¦é¡¹ |
| | | int ExpandCatChildFolder(int hItem, KXMLDOMElement ele, int image) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.SelectNodes(L"item"); |
| | | int len = nlist.length; |
| | | if (len > 0) tv_folder.SetItemChild(hItem, 1); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = nlist.item(i); |
| | | xstring name = e.getAttribute(L"name"); |
| | | int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), image); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | int MakeGoodCarFolderItem(int hItem) |
| | | { |
| | | xml x = ShoppingCartView::GetRoleList(); |
| | | if (!x) return 0; |
| | | KXMLDOMNodeList nlist = x.SelectNodes(L"/data/item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = nlist.item(i); |
| | | xstring name = e.getAttribute(L"name"); |
| | | int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), 35); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandItem(int hItem) |
| | | { |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | int child = tv_folder.GetChildItem(hItem); |
| | | xstring no = L""; |
| | | KXMLDOMElement e; |
| | | if (name == L"å
¬å¸åº" && !child) |
| | | { |
| | | no = L""; |
| | | if (hTopItem != hItem) |
| | | { |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute(L"categoryid"); |
| | | } |
| | | else |
| | | { |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute(L"categoryid"); |
| | | } |
| | | MakeGoodsFolderItem(hItem, no); |
| | | } |
| | | else if (name == L"个人åº" && !child) |
| | | { |
| | | no = L""; |
| | | if (hTopItem != hItem) |
| | | { |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute(L"categoryid"); |
| | | MakeUserGoodsFolderItem(hItem, no); |
| | | } |
| | | } |
| | | else if (name == L"è´ç©è½¦" && !child) |
| | | { |
| | | if (hItem == hTopItem)MakeGoodCarFolderItem(hItem); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //æ å±å¼ |
| | | int OnTreeExpanding(TEvent * evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | return ExpandItem(hItem); |
| | | } |
| | | |
| | | int ResetAgent(xstring agentAsk) |
| | | { |
| | | if (agentFor != agentAsk) |
| | | { |
| | | agentFor = agentAsk; |
| | | m_agentNode = 0; |
| | | SetAgent(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int LookupCustomerFolder(int hItem) |
| | | { |
| | | while (true) |
| | | { |
| | | KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | xstring str = e1.getAttribute(L"no"); |
| | | if (str.find(L"Customer:") >= 0) return hItem; |
| | | hItem = tv_folder.GetParentItem(hItem); |
| | | if (hItem == 0) break; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | xstring LookupCustomer(int hItem) |
| | | { |
| | | hItem = LookupCustomerFolder(hItem); |
| | | if (hItem == 0) return ""; |
| | | KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | xstring str = e1.getAttribute(L"no"); |
| | | return str.mid(L"Customer:".length(), 9999); |
| | | } |
| | | |
| | | int RetrieveData() |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | |
| | | xcontrol query = GetControl(L"sl_search"); |
| | | xstring queryString = query.GetText(); |
| | | |
| | | if (hItem == hTopItem) |
| | | { |
| | | dw_list.Reset(); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | dwc_list.Reset(); |
| | | dwc_list.SetReadOnly(true); |
| | | dwc_list.Redraw(); |
| | | |
| | | im.ResetEx(); |
| | | im.Redraw(); |
| | | |
| | | |
| | | htmlctrl xs1 = GetControl(L"html_detail"); |
| | | xs1.SetContent(L"<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>"); |
| | | |
| | | if (name != L"å
¬å¸åº") return 1; |
| | | } |
| | | //return 1; |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | |
| | | if (name == L"è´ç©è½¦") |
| | | { |
| | | if (selectname != name) |
| | | { |
| | | KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | xstring str = e1.getAttribute(L"no"); |
| | | alert(str); |
| | | if (str.find(L"Customer:") == 0 || str.find(L"SO:") == 0) |
| | | { |
| | | m_customer = LookupCustomer(hItem); |
| | | if (str.find(L"Customer:") == 0) |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodscustomerlist"); |
| | | else |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodssolist"); |
| | | dwc_list.Reset(); |
| | | dwc_list.SetReadOnly(true); |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); |
| | | } |
| | | else if (e1.getAttribute(L"categoryid") != L"") |
| | | { |
| | | xstring categoryid = e1.getAttribute(L"categoryid"); |
| | | dwc_list.SetDataObject(ProductLibraryView::GetMaintListForm3(categoryid).GetXmlDoc()); |
| | | dwc_list.SetReadOnly(true); |
| | | dwc_list.Reset(); |
| | | g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString, L"")); |
| | | dwc_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodslist"); |
| | | dwc_list.SetReadOnly(true); |
| | | dwc_list.Reset(); |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); |
| | | } |
| | | dwc_list.PostRetrieve(); |
| | | dwc_list.Redraw(); |
| | | |
| | | if (dwc_list.GetRowCount() >= 1) |
| | | { |
| | | htmlctrl xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeGoodscarHtml(1)); |
| | | |
| | | if (m_customer != L"") |
| | | { |
| | | xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", 1, L"SKUID"); |
| | | xstring customerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", 1, L"CustomerItemNo"); |
| | | OnShowImage(skuid, customerItemNo); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | im.ResetEx(); |
| | | im.Redraw(); |
| | | |
| | | xs = GetControl(L"html_detail"); |
| | | xs.SetContent(L"<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>"); |
| | | } |
| | | xs.Redraw(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | |
| | | if (name == L"个人åº" || name == L"å
¬å¸åº") |
| | | { |
| | | xstring no = L"N000005"; |
| | | if (name == L"个人åº") no = L"U000005"; |
| | | |
| | | if (hItem != hTopItem) |
| | | { |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute(L"guid"); |
| | | } |
| | | |
| | | /* dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(no).GetXmlDoc()); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.Reset(); |
| | | dw_list.SetReadOnly(true); |
| | | */ |
| | | |
| | | if (name == L"个人åº") |
| | | g_xdoc_product.Retrieve(ProductLibraryView::GetMaintRoleList3(no)); |
| | | else |
| | | { |
| | | if (queryString != L"") |
| | | { |
| | | |
| | | if (no == L"N000005") |
| | | g_xdoc_product.Retrieve(ProductLibraryView::GetMaintList3(L"", queryString, L"")); |
| | | else |
| | | g_xdoc_product.Retrieve(ProductLibraryView::GetMaintList3(no, queryString, L"")); |
| | | } |
| | | else |
| | | g_xdoc_product.Retrieve(ProductLibraryView::GetMaintList3(no)); |
| | | } |
| | | dw_list.PostRetrieve(); |
| | | dw_list.Redraw(); |
| | | |
| | | if (dw_list.GetRowCount() > 0) |
| | | { |
| | | xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | xstring id = g_xdoc_product.getData(0, L"data/Item", 1, L"@guid"); |
| | | OnShowImage(id); |
| | | } |
| | | else |
| | | { |
| | | im.ResetEx(); |
| | | im.Redraw(); |
| | | |
| | | xs = GetControl(L"html_detail"); |
| | | xs.SetContent(L"<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>"); |
| | | } |
| | | xs.Redraw(); |
| | | } |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(TEvent * evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW); |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | ximageview im = GetControl(L"im1"); |
| | | m_customer = L""; |
| | | //alert(name); |
| | | if (name == L"è´ç©è½¦") |
| | | { |
| | | if (agentFor != L"goodscar")SwitchLayer(L"goodscarsheet", L"sheetframe"); |
| | | ResetAgent(L"goodscar"); |
| | | } |
| | | else |
| | | { |
| | | if (agentFor != L"goodslib")SwitchLayer(L"goodslibsheet", L"sheetframe"); |
| | | if (name == L"个人åº") |
| | | ResetAgent(L"userlib"); |
| | | else |
| | | ResetAgent(L"goodslib"); |
| | | } |
| | | //RetrieveData(); |
| | | win32::PostMessage(GetHWND(), 0x401, L"xmRefresh", 0); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandChildFolder(int hItem, KXMLDOMElement pElement) |
| | | { |
| | | KXMLDOMNodeList nlist = pElement.SelectNodes(L"Item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement e = nlist.item(i); |
| | | xstring name = e.getAttribute(L"cname"); |
| | | xstring sImage = e.getAttribute(L"image"); |
| | | int image = 15; |
| | | //if(sImage) image = sImage.toInt(); |
| | | int h = tv_folder.InsertChildItem(tv_folder.GetId(), hItem, name, trust(e as int), image); |
| | | tv_folder.SetItemChild(h, 1); |
| | | ExpandChildFolder(h, e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int InitialFolder() |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement e = xframeElement.selectSingleNode(L"//xtree[@name='tv_folder']/initial"); |
| | | ExpandChildFolder(0, e); |
| | | return 1; |
| | | } |
| | | |
| | | int OnViewZoomChange(ref TCommandEvent evt, int lParam) |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | xcombobox xc = GetControl(L"precent"); |
| | | xstring text = xcombobox::GetLBText(xc.GetId()); |
| | | int p = text.toInt(); |
| | | if (p == 0) p = 100; |
| | | im.Preview(p); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", OnRowChanged); |
| | | AttachEvent(L"dwc_list", L"DWV_ROWFOCUSCHANGED", OnGoodsCarRowChanged); |
| | | AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING", OnTreeExpanding); |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", OnTreeSelChanged); |
| | | AttachEvent(L"WM_COMMAND", OnCkbCLick); //checkboxæé©äºä»¶ |
| | | AttachEvent(L"WM_COMMAND", OnCkbCLick2); //checkboxæé©äºä»¶ |
| | | |
| | | AttachEvent(L"im1", L"IMG_LDBCLICK", OnImgDBClicked); |
| | | AttachEvent(L"precent", L"CBN_SELCHANGE", OnViewZoomChange); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | agentFor = L"goodslib"; |
| | | m_customer = 0; |
| | | imageElement = 0; |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dwc_list = GetControl(L"dwc_list"); |
| | | |
| | | InitialFolder(); |
| | | |
| | | g_xdoc_product = new xdataset; |
| | | g_xdoc_product.Init(); |
| | | xbind bindproduct = new xbind; |
| | | bindproduct.bindEx(dw_list, g_xdoc_product, L""); |
| | | |
| | | g_xdoc_shoppingcart = new xdataset; |
| | | g_xdoc_shoppingcart.Init(); |
| | | |
| | | xbind bindcart = new xbind; |
| | | bindcart.bindEx(dwc_list, g_xdoc_shoppingcart, L""); |
| | | |
| | | dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"").GetXmlDoc()); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodslist"); |
| | | dwc_list.SetReadOnly(true); |
| | | |
| | | if (dw_list.GetRowCount()) |
| | | { |
| | | htmlctrl xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | } |
| | | |
| | | tv_folder.ExpandItem(tv_folder.GetRootItem()); |
| | | tv_folder.ItemFocus(tv_folder.GetRootItem()); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnImgDBClicked(TEvent * evt, int pr) |
| | | { |
| | | ref IMGNNMHDR nmtv = evt.pnmh; |
| | | xstring src = nmtv.path; |
| | | /*if(src.length() > 60) |
| | | src = src.right(44); |
| | | else |
| | | src=src.mid(src.find(L"Thumbs", 0)+6, 50); |
| | | */ |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //arg.AddArg(L"src",L"/business/products/chanpin"+src); |
| | | arg.AddArg(L"src", src); |
| | | |
| | | //win::OpenWindow(L"dev:xpage[BigPicture.vx]",arg); |
| | | |
| | | int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", arg); |
| | | return 1; |
| | | /* |
| | | xwin x = new xwin; |
| | | x.setNativePointer(h); |
| | | m_winHwnd = x.GetHWND(); |
| | | |
| | | xstring sh = doc.GetXml(); |
| | | int p = cast(sh as int); |
| | | win32::SendMessage(m_winHwnd, 0x401, p, 0); |
| | | */ |
| | | return 1; |
| | | } |
| | | }; |