¶Ô±ÈÐÂÎļþ |
| | |
| | | #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) ProductSelectSOWin : public xwin |
| | | { |
| | | public: |
| | | int hObject = 0; |
| | | xstring CustomerID; |
| | | xstring CustomerName; |
| | | |
| | | //产ååºäº§åå表 |
| | | 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; |
| | | xstring impStr; |
| | | public: |
| | | ProductSelectSOWin(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {} |
| | | public: |
| | | static ProductSelectSOWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ProductSelectSOWin* pWin = new ProductSelectSOWin(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 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 1; |
| | | KXMLDOMElement e = g_xdoc_shoppingcart.getRowElement(L"data/Item", row); |
| | | return e; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM 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 skuno = g_xdoc_product.getData(0, L"data/Item", row, L"SKUNo"); |
| | | OnShowImage(skuno); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnGoodsCarRowChanged(TEvent* evt, LPARAM 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(); |
| | | |
| | | xstring skuno = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"No"); |
| | | //alert(skuno); |
| | | OnShowImage(skuno); |
| | | |
| | | 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); |
| | | }*/ |
| | | dw_obj.SetSelectionMode(3); |
| | | 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.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", guid); |
| | | if (xurl::get(L"/sale/data/SO/goods/goodsprop/list", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | alert(error); |
| | | } |
| | | return x; |
| | | } |
| | | |
| | | int OnShowImage(xstring skuno) |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | im.RemoveImage(); |
| | | |
| | | xml xp ; |
| | | xaserverarg arg_pic ; |
| | | arg_pic.AddArg(L"SKUNo", skuno); |
| | | if (xurl::get(L"/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo", arg_pic.GetString(), xp) != 1) |
| | | { |
| | | trace(xstring(L"xxx") + xp.xml()); |
| | | } |
| | | else |
| | | { |
| | | 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, goodno); |
| | | } |
| | | im.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | 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-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'>" + dw_list.GetItemString(row, L"No") + |
| | | 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 (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; |
| | | |
| | | //æ¾ç¤ºå¾ç |
| | | /*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.toUpper(); |
| | | 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; |
| | | } |
| | | |
| | | int Up(xstring name) { |
| | | //int ret1 = 3; |
| | | xstring str = name.mid(0, 2); |
| | | str = str.toUpper(); |
| | | //alert(str); |
| | | int ret1 = xaserver::UploadFile(L"product" + str, name + L".jpg", GetHWND(), L"", false); |
| | | |
| | | //trace(ret1); |
| | | return ret1; |
| | | } |
| | | int OnAddImage() { |
| | | 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 ret1 = Up(id); |
| | | //alert(ret1.toString()); |
| | | if (ret1 == -1) |
| | | return -1; |
| | | if (ret1 == 0) |
| | | { |
| | | alert(L"ä¸ä¼ å¾ç失败"); |
| | | return -1; |
| | | } |
| | | |
| | | //GoodsLib:GetList($parent) goodslib.object.xq |
| | | // å¾çåå å
¥æ°æ®åº |
| | | xstring path = L"data/Item"; |
| | | g_xdoc_product.xdoc.SetXPath(path); |
| | | g_xdoc_product.setItem(path, row, L"ImgName", id + L".jpg"); |
| | | KXMLDOMElement e1 = g_xdoc_product.getRowElement(L"data/Item", row); |
| | | xstring val = e1.xml(); //g_xdoc_product.GetContent(); |
| | | //trace(val); |
| | | xml x ; |
| | | xaserverarg arg; |
| | | arg.AddArg(L"content", val); |
| | | if (xurl::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | return -1; |
| | | } |
| | | //alert(x.GetXml()); |
| | | //xstring ImgName = g_xdoc_product.getItemString(path,row, L"ImgName"); |
| | | //alert(ImgName); |
| | | |
| | | //å·æ°ä¸ä¸çé¢ï¼æ¾ç¤ºå¾ç |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | xstring html = makeHtml(row); |
| | | xs.SetContent(html); |
| | | xs.Redraw(); |
| | | |
| | | //alert(L"ä¸ä¼ å¾çæåï¼"); |
| | | return 1; |
| | | } |
| | | int OnDeleteImage() { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dw_list.GetRow(); |
| | | if (row < 1 || row > dw_list.GetRowCount()) return 0; |
| | | KXMLDOMElement e1 = g_xdoc_product.getRowElement(L"data/Item", row); |
| | | xstring val = e1.xml(); |
| | | xml x ; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", val); |
| | | if (xurl::get(L"/sale/data/ProductLibrary/image/delete", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | return -1; |
| | | } |
| | | |
| | | 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"); |
| | | |
| | | int pr = g_xdoc_product; |
| | | OpenWindow(L"dev:xpage[PictureView.Product3.vx]", pr); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ItemMaint() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)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); |
| | | } |
| | | */ |
| | | |
| | | int pr = g_xdoc_product; |
| | | OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", pr); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ItemAdd() |
| | | { |
| | | |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)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; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", e.getAttribute(L"guid")); |
| | | arg.AddArg(L"No", e.getAttribute(L"CategoryNo")); |
| | | arg.AddArg(L"CName", e.getAttribute(L"CName")); |
| | | int p = arg; |
| | | OpenWindow(L"dev:xpage[Quick.Input.Product.vx]", p); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnImport() |
| | | { |
| | | if (!hObject) return 1; |
| | | |
| | | int rw = 0; |
| | | xstring ls_nos = L"ImportXml:"; |
| | | /* |
| | | if(agentFor !=L"goodscar") |
| | | { |
| | | rw = dw_list.GetNextSelectRow(1); |
| | | if (rw<1 || rw > dw_list.GetRowCount()) |
| | | { |
| | | alert(L"è¯·éæ©åå!"); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | while (rw>0) |
| | | { |
| | | ls_nos += L",L"+dw_list.GetItemString(rw, L"SKUNo"); |
| | | //ls_nos += L",L"+dw_list.GetItemString(rw, L"GoodsNo"); |
| | | //ls_nos += L",L"+dw_list.GetItemString(rw, L"GoodNo"); |
| | | rw = dw_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | dw_list.SelectRow(0,false); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | rw = dwc_list.GetNextSelectRow(1); |
| | | if (rw<1 || rw > dwc_list.GetRowCount()) |
| | | { |
| | | alert(L"è¯·éæ©åå!"); |
| | | return 1; |
| | | } |
| | | |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | hItem = LookupCustomerFolder(hItem); |
| | | if(!hItem) |
| | | { |
| | | //trace(L"-------"); |
| | | return 1; |
| | | } |
| | | |
| | | KXMLDOMElement e = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | xstring no = e.getAttribute(L"no"); |
| | | xstring name = e.getAttribute(L"name"); |
| | | xstring customer = no.mid(no.find(L":")+1,99999); |
| | | xstring customername = name.mid(no.find(L":")+1,99999); |
| | | if(CustomerID !=L"" && CustomerID != customer) |
| | | { |
| | | alert(L"åªè½è½¬å
¥"+CustomerName+L"æ¥ä»·æ°æ®!"); |
| | | return 1; |
| | | } |
| | | if(CustomerID==L"") |
| | | { |
| | | CustomerID = customer; |
| | | CustomerName = customername; |
| | | win32::SendMessage(hObject,0x401,L"xmSetCustomer:"+CustomerID+L"\t"+CustomerName,0); |
| | | } |
| | | |
| | | while (rw>0) |
| | | { |
| | | xstring ql = g_xdoc_shoppingcart.getData(0,L"data/Item",rw,L"QuoteLineID"); |
| | | if(ql !=L"") |
| | | ls_nos +=L" "+L"ql:"+ql; |
| | | else if(dwc_list.GetItemString(rw, L"SKUNo") !=L"") |
| | | ls_nos += L" "+dwc_list.GetItemString(rw, L"SKUNo"); |
| | | else |
| | | ls_nos += L" "+dwc_list.GetItemString(rw, L"No"); |
| | | //trace(ls_nos); |
| | | rw = dwc_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | dwc_list.SelectRow(0,false); |
| | | dwc_list.Redraw(); |
| | | } |
| | | */ |
| | | if (impStr == L"") |
| | | { |
| | | alert(L"è¯·éæ©åå!"); |
| | | return 1; |
| | | } |
| | | ls_nos += impStr; |
| | | dwc_list.SelectRow(0, false); |
| | | dwc_list.Redraw(); |
| | | dw_list.SelectRow(0, false); |
| | | dw_list.Redraw(); |
| | | impStr = L""; |
| | | |
| | | SendMessageW(hObject, 0x401, ls_nos, 0); |
| | | alert(L"转å
¥å®æ!"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSearch() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | return RetrieveItem(hItem); |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | int hCursor; |
| | | xstring name = L""; |
| | | if (comdid == L"xmCarGoodsDelete") |
| | | { |
| | | CarGoodsDelete(); |
| | | return 1; |
| | | } |
| | | 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; |
| | | carg.AddArg(L"content", content); |
| | | |
| | | OpenWindow(L"dev:xpage[SO.Simulation.Import.vx]", (LPARAM)&carg); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmEnquiry") |
| | | { |
| | | 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; |
| | | |
| | | carg.AddArg(L"content", content); |
| | | |
| | | OpenWindow(L"dev:xpage[Enquiry.Import.vx]", (LPARAM)&carg); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmPurchar") |
| | | { |
| | | 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 ; |
| | | |
| | | carg.AddArg(L"content", content); |
| | | |
| | | OpenWindow(L"dev:xpage[PO.Import.vx]", (LPARAM)&carg); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmQuote") |
| | | { |
| | | 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; |
| | | |
| | | carg.AddArg(L"content", content); |
| | | |
| | | OpenWindow(L"dev:xpage[Quote.Import.vx]", (LPARAM)&carg); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmAdd") |
| | | { |
| | | return ItemAdd(); |
| | | } |
| | | else if (comdid == L"xmDelete") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | DeleteRow(row); |
| | | |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmCarAdd") |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | name = xcontrol(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); |
| | | dwc_list.PostRetrieve(); |
| | | dw_list.PostRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmToCar") |
| | | { |
| | | name = xcontrol(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; |
| | | } |
| | | else if (comdid == L"xmImport") |
| | | { |
| | | OnImport(); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == L"xmSearch") |
| | | { |
| | | OnSearch(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | HTREEITEM LookupCustomerFolder(HTREEITEM hItem) |
| | | { |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | xstring no = e.getAttribute(L"no"); |
| | | if (no.find(L"Customer1:") >= 0) return hItem; |
| | | |
| | | while (tv_folder.GetParentItem(hItem)) |
| | | { |
| | | hItem = tv_folder.GetParentItem(hItem); |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute(L"no"); |
| | | if (no.find(L"Customer1:") >= 0) return hItem; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //æ¥æ¾å½åæ 项ç顶级ç®å½ |
| | | HTREEITEM LookupTopFolder(HTREEITEM hItem) |
| | | { |
| | | HTREEITEM hRoot = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); |
| | | return hItem; |
| | | } |
| | | |
| | | //æå
¥äº§å类项çå项 |
| | | int MakeGoodsFolderItem(HTREEITEM 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 = *new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e.getAttribute(L"CName"); |
| | | xstring no = e.getAttribute(L"CategoryNo"); |
| | | xstring label = no.trim() + L" " + name; |
| | | |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, label, (LPARAM)&e, 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(HTREEITEM 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 = *new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, image); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | int MakeGoodCarFolderItem(HTREEITEM 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 = *new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, 35); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //æ å±å¼ |
| | | int OnTreeExpanding(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | HTREEITEM hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | HTREEITEM child = tv_folder.GetChildItem(hItem); |
| | | xstring no = L""; |
| | | KXMLDOMElement e; |
| | | |
| | | if (name == L"å
¬å¸åº" && !child) |
| | | { |
| | | no = L"N000005"; |
| | | 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"U000005"; |
| | | if (hTopItem != hItem) |
| | | { |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute(L"no"); |
| | | } |
| | | MakeGoodsFolderItem(hItem, no); |
| | | } |
| | | else if (name == L"è´ç©è½¦" && !child) |
| | | { |
| | | if (hItem == hTopItem) |
| | | |
| | | MakeGoodCarFolderItem(hItem); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ResetAgent(xstring agentAsk) |
| | | { |
| | | if (agentFor != agentAsk) |
| | | { |
| | | agentFor = agentAsk; |
| | | m_agentNode = 0; |
| | | SetAgent(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int RetrieveItem(HTREEITEM hItem) |
| | | { |
| | | HTREEITEM hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | dw_list.SelectRow(0, false); |
| | | dwc_list.SelectRow(0, false); |
| | | |
| | | xcontrol query = GetControl(L"sl_search"); |
| | | xstring queryString = query.GetText(); |
| | | |
| | | if (name == L"è´ç©è½¦") |
| | | { |
| | | if (agentFor != L"goodscar")SwitchLayer(L"goodscarsheet", L"sheetframe"); |
| | | ResetAgent(L"goodscar"); |
| | | |
| | | if (selectname != name) |
| | | { |
| | | KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); |
| | | xstring str = e1.getAttribute(L"no"); |
| | | if (str.find(L"Customer1:") == 0 || str.find(L"Customer:") == 0 || str.find(L"SO:") == 0 || str.find(L"Quote:") == 0) |
| | | { |
| | | if (str.find(L"Customer:") == 0 || str.find(L"Customer1:") == 0) |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodscustomerlist"); |
| | | else { |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodssolist"); |
| | | } |
| | | dwc_list.SetReadOnly(true); |
| | | trace(str + L"+++++L" + queryString); |
| | | 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); |
| | | |
| | | g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString, L"")); |
| | | } |
| | | else |
| | | { |
| | | |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodslist"); |
| | | dwc_list.SetReadOnly(true); |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); |
| | | } |
| | | dwc_list.PostRetrieve(); |
| | | dwc_list.Redraw(); |
| | | |
| | | if (dwc_list.GetRowCount() >= 0) |
| | | { |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeGoodscarHtml(1)); |
| | | } |
| | | else |
| | | { |
| | | xs = GetControl(L"html_detail"); |
| | | xs.SetContent(L"<html><body/></html>"); |
| | | } |
| | | xs.Redraw(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (agentFor != L"goodslib")SwitchLayer(L"goodslibsheet", L"sheetframe"); |
| | | ResetAgent(L"goodslib"); |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | 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.SetReadOnly(true); |
| | | |
| | | g_xdoc_product.Retrieve(ProductLibraryView::GetMaintList3(no, queryString, L"")); |
| | | dw_list.PostRetrieve(); |
| | | dw_list.Redraw(); |
| | | |
| | | if (dw_list.GetRowCount() >= 0) |
| | | { |
| | | xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | } |
| | | else |
| | | { |
| | | xs = GetControl(L"html_detail"); |
| | | xs.SetContent(L"<html/>"); |
| | | } |
| | | xs.Redraw(); |
| | | xutil::RestoreCursor(hCursor); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(TEvent* evt, int p) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | |
| | | return RetrieveItem(hItem); |
| | | } |
| | | |
| | | int ExpandChildFolder(HTREEITEM hItem, KXMLDOMElement pElement) |
| | | { |
| | | KXMLDOMNodeList nlist = pElement.selectNodes(L"Item"); |
| | | int len = nlist.length(); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | KXMLDOMElement& e = *new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e.getAttribute(L"cname"); |
| | | xstring sImage = e.getAttribute(L"image"); |
| | | int image = 15; |
| | | //if(sImage) image = sImage.toInt(); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, (LPARAM)&e, 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 OnDwClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | char ch; |
| | | int row = hdr.row; |
| | | xstring col = hdr.colname; |
| | | |
| | | xstring str = L""; |
| | | if (dw_list.GetItemString(row, L"SKUNo") != L"") |
| | | str = dw_list.GetItemString(row, L"SKUNo"); |
| | | else |
| | | str = dw_list.GetItemString(row, L"No"); |
| | | |
| | | if (dw_list.IsRowSelected(row) & 0xff) |
| | | { |
| | | //will unselect |
| | | impStr = impStr.replace(L" " + str, L""); |
| | | } |
| | | else |
| | | { |
| | | //will select |
| | | impStr += L" " + str; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDwcClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | char ch; |
| | | int row = hdr.row; |
| | | xstring col = hdr.colname; |
| | | |
| | | xstring str = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"QuoteLineID"); |
| | | if (str != L"") |
| | | str = L"ql:" + str; |
| | | else if (dwc_list.GetItemString(row, L"SKUNo") != L"") |
| | | str = dwc_list.GetItemString(row, L"SKUNo"); |
| | | else |
| | | str = dwc_list.GetItemString(row, L"No"); |
| | | |
| | | if (dwc_list.IsRowSelected(row) & 0xff) |
| | | { |
| | | //will unselect |
| | | impStr = impStr.replace(L" " + str, L""); |
| | | } |
| | | else |
| | | { |
| | | //will select |
| | | impStr += L" " + str; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | xstring ls_nos = L"ImportXml:"; |
| | | xstring str = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SOLineID"); |
| | | xstring str1 = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"EnquiryPriceListID"); |
| | | if (str1 != L"") |
| | | str += L"el:" + str1; |
| | | else if (str != L"") |
| | | str = L"sl:" + str; |
| | | else if (dwc_list.GetItemString(row, L"SKUNo") != L"") |
| | | str = dwc_list.GetItemString(row, L"SKUNo"); |
| | | else |
| | | str = dwc_list.GetItemString(row, L"No"); |
| | | ls_nos += str; |
| | | |
| | | dw_list.SelectRow(0, false); |
| | | dwc_list.SelectRow(0, false); |
| | | dw_list.Redraw(); |
| | | dwc_list.Redraw(); |
| | | impStr = L""; |
| | | win32::SendMessage(hObject, 0x401, ls_nos, 0); |
| | | |
| | | xutil::RestoreCursor(hCursor); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ProductSelectSOWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ProductSelectSOWin::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductSelectSOWin::OnRowChanged); |
| | | AttachEvent(L"dwc_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductSelectSOWin::OnGoodsCarRowChanged); |
| | | AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING", (FEvent)&ProductSelectSOWin::OnTreeExpanding); |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&ProductSelectSOWin::OnTreeSelChanged); |
| | | AttachEvent(L"WM_COMMAND", (FEvent)&ProductSelectSOWin::OnCkbCLick); //checkboxæé©äºä»¶ |
| | | AttachEvent(L"WM_COMMAND", (FEvent)&ProductSelectSOWin::OnCkbCLick2); //checkboxæé©äºä»¶ |
| | | AttachEvent(L"dw_list", L"DWV_CLICKED", (FEvent)&ProductSelectSOWin::OnDwClicked); |
| | | AttachEvent(L"dwc_list", L"DWV_CLICKED", (FEvent)&ProductSelectSOWin::OnDwcClicked); |
| | | |
| | | AttachEvent(L"dwc_list", L"DWV_DOUBLECLICKED", (FEvent)&ProductSelectSOWin::OnImport); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | agentFor = L"goodslib"; |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dwc_list = GetControl(L"dwc_list"); |
| | | |
| | | xaserverarg arg; |
| | | CustomerID = L""; |
| | | CustomerName = L""; |
| | | hObject = 0; |
| | | if (arg) |
| | | { |
| | | hObject = (int)arg.GetArgString(L"HWND"); |
| | | CustomerID = arg.GetArgString(L"CustomerID"); |
| | | } |
| | | 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()) |
| | | { |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | } |
| | | |
| | | //xtreeview::ExpandItem(tv_folder.GetId(), |
| | | // xtreeview::GetNextItem(tv_folder.GetId(),xtreeview::GetRootItem(tv_folder.GetId()))); |
| | | xtreeview::ExpandItem(tv_folder.GetId(), xtreeview::GetRootItem(tv_folder.GetId())); |
| | | |
| | | dw_list.SetSelectionMode(3); |
| | | dwc_list.SetSelectionMode(3); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |