¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | #include <xcontrol/xcell.hpp> |
| | | |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) ProductFetchNoWin : public xframe |
| | | { |
| | | public: |
| | | xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | public: |
| | | ProductFetchNoWin(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ProductFetchNoWin* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ProductFetchNoWin* pWin = new ProductFetchNoWin(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int SetAgent() |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | SetAgentNode(anode, m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement xframeElement = GetElement(); |
| | | KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/" + xfNodeAgentArea + L"[1]/*"); |
| | | if (agent) |
| | | { |
| | | xstring s = agent.xml(); |
| | | m_agentNode = SetAgentNode(anode, s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | /* |
| | | htmlctrl xs = GetControl(L"html_detail"); |
| | | xstring html = makeHtml(row); |
| | | xs.SetContent(html); |
| | | xs.Redraw(); |
| | | |
| | | xstring id = g_xdoc_product.getData(0,L"data/Item",row,L"@guid"); |
| | | OnShowImage(id); |
| | | */ |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(TEvent* evt, LPARAM p) |
| | | { |
| | | //é置工å
·æ¡ |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int SendNotice() |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | if (dw_list.GetRowCount() < 1) return 1; |
| | | xstring Subject = L"ç¼å·ï¼" + dw_list.GetItemString(dw_list.GetRow(), L"SKUNo") + L" ååï¼" + dw_list.GetItemString(dw_list.GetRow(), L"CName") + L"ï¼ç³è¯·è´§å·"; |
| | | xstring EntityID = dw_list.GetItemString(dw_list.GetRow(), L"SKUID"); |
| | | xstring EntityNo = dw_list.GetItemString(dw_list.GetRow(), L"SKUNo"); |
| | | xstring Category = L"è´§å·ç³è¯·"; |
| | | xstring Reciever = L"00908"; |
| | | xstring Content = L""; |
| | | //alert(L"EntityID:"+EntityID); |
| | | xml x = ViewObject::AddMessage(Category, Reciever, EntityNo, EntityID, Subject, Content); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSubmit() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | if (dw_list.GetRowCount() < 1) return 0; |
| | | xml x; |
| | | |
| | | dw_list.DwUpdateAllToEx(x); |
| | | xstring error = L""; |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xurl::get(L"/sale/data/ProductLibrary3/update/product/askgoodsno", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | if (error.find(L"error") >= 0) |
| | | alert(L"æäº¤å¤±è´¥"); |
| | | else |
| | | alert(L"æäº¤æå!"); |
| | | SendNotice(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | xstring makeHtml(int row) |
| | | { |
| | | xstring id = g_xdoc_product.getData(0,L"data/Item",row,L"@guid"); |
| | | xml x = GetGoodsPropList(id); |
| | | xml x1 = GetGoodsPropListEx(id); |
| | | |
| | | xstring html=L"<html><style> .text{ font-weight:400} .label { font-weight:400;}</style><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'>"; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >ç¼å·:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"SKUNo")+ |
| | | "</span> <span style='font-weight:700;width:50;font-size:10pt' >类项:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"RefNo")+ |
| | | "</span></div>"; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >å
¬å¸åå·:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"GoodsNo")+ |
| | | "</span></div>" ; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >åå:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"CName")+ |
| | | "</span></div>" ; |
| | | if(dw_list.GetItemString(row,L"CSpec")!=L"") |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >è§æ ¼:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row,L"CSpec")+ |
| | | "</span></div>" ; |
| | | |
| | | KXMLDOMNodeList fieldsEx = x1.GetXmlDoc().selectNodes(L"data/field"); |
| | | xstring ls_detail=L""; |
| | | xstring ls_item =L""; |
| | | xstring name; |
| | | xstring label; |
| | | int len = fieldsEx.length; |
| | | int i= 0; |
| | | |
| | | for(i=0;i<len; true) |
| | | { |
| | | int cnt = 0; |
| | | ls_item = L""; |
| | | while(cnt < 2) |
| | | { |
| | | name = fieldsEx.item(i).selectSingleNode(L"@name").text; |
| | | label = fieldsEx.item(i).selectSingleNode(L"@label").text; |
| | | ls_item += L"<td>" + label + L"</td>" + L"<td style='text-align:center'>" + g_xdoc_product.getData(0,L"data/Item",row,name) + L"</td>" ; |
| | | cnt++; |
| | | i++; |
| | | if(i ==len)break; |
| | | } |
| | | ls_detail += L"<tr>" + ls_item + L"</tr>"; |
| | | } |
| | | html += L"<div style='margin-left:8px;margin-right:16px;'>" + |
| | | +L"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>" |
| | | + ls_detail |
| | | +L"</table>" |
| | | +L"</div>" ; |
| | | |
| | | xstring ls_star=L""; |
| | | KXMLDOMNodeList fields = x().selectNodes(L"data/field"); |
| | | len = fields.length; |
| | | |
| | | ls_detail = L""; |
| | | if(len > 0) |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >ææ¯è¦æ±:</span></div>" ; |
| | | for(i=0;i<len; true) |
| | | { |
| | | ls_item=L""; |
| | | |
| | | int count = 0; |
| | | while(count < 2) |
| | | { |
| | | name = fields.item(i).selectSingleNode(L"@name").text; |
| | | label = fields.item(i).selectSingleNode(L"@label").text; |
| | | if(name==L"QualityTerm" || name==L"PackTerm" || label==L"è´¨é" || label==L"å
è£
è´¨é" || label==L"ææ¯è¦æ±") |
| | | { |
| | | i++; |
| | | if(i >= len)count = 2; |
| | | continue; |
| | | } |
| | | else if(g_xdoc_product.getData(0,L"data/Item",row,name)==L"") |
| | | { |
| | | KXMLDOMNodeList options = fields.item(i).selectNodes(L"item"); |
| | | int tlen = options.length; |
| | | xstring terms = L"" ; |
| | | for(int k=0; k<tlen; k++) |
| | | { |
| | | if(options.item(k).text) |
| | | { |
| | | if(k>0) terms += L", L"; |
| | | terms += L"[" + options.item(k).text +L"]"; |
| | | } |
| | | } |
| | | ls_star += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >" + label +L"*:</span><span style='width:90;font-size:10pt'>" + terms + L"</span></div>" ; |
| | | }else |
| | | { |
| | | ls_item = L"<td>" + label + L"</td>" + L"<td>" + g_xdoc_product.getData(0,L"data/Item",row,name) + L"</td>" ; |
| | | count++; |
| | | } |
| | | i++; |
| | | if(i >= len)count = 2; |
| | | } |
| | | ls_item = L"<tr>" + ls_item + L"</tr>"; |
| | | ls_detail += ls_item; |
| | | } |
| | | |
| | | html += L"<div style='margin-left:8px;margin-right:16px;'>" + |
| | | +L"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>" |
| | | + ls_detail |
| | | +L"</table>" |
| | | +L"</div>" ; |
| | | if(dw_list.GetItemString(row,L"QualityTerm")!=L"") |
| | | { |
| | | html += L"<div style='height:12px'/>"; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >è´¨é:</span></div>" ; |
| | | html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row,L"QualityTerm") + L"</span></div>" ; |
| | | } |
| | | |
| | | if(dw_list.GetItemString(row,L"PackTerm")!=L"") |
| | | { |
| | | html += L"<div style='height:12px'/>"; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >å
è£
è´¨é:</span></div>" ; |
| | | html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row,L"PackTerm") + L"</span></div>" ; |
| | | } |
| | | |
| | | if(g_xdoc_product.getData(0,L"data/Item",row,L"Remark")!=L"") |
| | | { |
| | | //html += L"<div style='height:12px'/>"; |
| | | html += L"<div ><span style='font-weight:700;width:50;font-size:10pt' >夿³¨:</span></div>" ; |
| | | html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + g_xdoc_product.getData(0,L"data/Item",row,L"Remark") + L"</span></div>" ; |
| | | } |
| | | |
| | | html += L"<div style='height:24px'/>"; |
| | | |
| | | //ææ é¡¹ |
| | | html += ls_star; |
| | | |
| | | |
| | | html += L"</body></html>"; |
| | | //trace(html); |
| | | return html; |
| | | } |
| | | */ |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"xmSubmit") |
| | | { |
| | | return OnSubmit(); |
| | | } |
| | | if (comdid == L"xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(TEvent* evt, LPARAM p) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductFetchNoWin::OnRowChanged); |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ProductFetchNoWin::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ProductFetchNoWin::OnSetFocus); |
| | | } |
| | | |
| | | /* |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new.xml(); |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"xxx",L"xxx"); |
| | | if (getUrl(L"",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | //dw_list.Retrieve(x); |
| | | //dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | */ |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"").GetXmlDoc()); |
| | | dw_list.SetColumnState(L"SKUID", false); |
| | | dw_list.SetColumnState(L"category1", false); |
| | | dw_list.SetColumnState(L"Submitter1", false); |
| | | |
| | | if (GetWinParam()) |
| | | { |
| | | xaserverarg arg; |
| | | xml x; |
| | | |
| | | if (xurl::get(L"/sale/data/ProductLibrary3/data/list/skunolist", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | } |
| | | } |
| | | OnAttachEvent(); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |