|  |  | 
 |  |  | use "xcontrol.vframe.vbusiness.vd" | 
 |  |  | use "xbase.vframe.vbusiness.vd" | 
 |  |  | use "base.view.vd" | 
 |  |  | #include <wobject/xstring.hpp> | 
 |  |  | #include <xcontrol/xtreeview.hpp> | 
 |  |  | #include <xcontrol/xdwgrid.hpp> | 
 |  |  | #include <wobject/xdouble.hpp> | 
 |  |  | #include <xcontrol/xlayersheet.hpp> | 
 |  |  | #include <xcontrol/xdatetimepick.hpp> | 
 |  |  |  | 
 |  |  | unit trade  | 
 |  |  | [ | 
 |  |  |    class CustomerItemNoList :  public xframe | 
 |  |  |  | 
 |  |  | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" | 
 |  |  | #include "viewobject/view.base.hpp" | 
 |  |  |  | 
 |  |  | using xml = KXMLDOMDocument; | 
 |  |  |  | 
 |  |  |    class __declspec(dllexport)  CustomerItemNoList :  public xframe | 
 |  |  |    { | 
 |  |  |    public: | 
 |  |  |       xdwgrid   dw_list; | 
 |  |  |  | 
 |  |  |       xnode   m_agentNode;   //Agent Condition | 
 |  |  |       int hObject = 0; | 
 |  |  |     | 
 |  |  |       string GoodsNo; | 
 |  |  |       xstring GoodsNo; | 
 |  |  |        | 
 |  |  | 	 | 
 |  |  |    public: | 
 |  |  |       CustomerItemNoList(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} | 
 |  |  |    public: | 
 |  |  |       static CustomerItemNoList* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |       { | 
 |  |  |          CustomerItemNoList* pWin = new CustomerItemNoList(implPtr, (HWND)hWnd); | 
 |  |  |          return pWin; | 
 |  |  |       } | 
 |  |  |       int SetAgent() | 
 |  |  |       { | 
 |  |  |          string xfNodeAgentArea  = "agentarea"; | 
 |  |  |          xstring xfNodeAgentArea  = L"agentarea"; | 
 |  |  |          xnode anode = GetAgentNode(xfNodeAgentArea); | 
 |  |  |          if(m_agentNode) | 
 |  |  |          { | 
 |  |  |             SetAgentNodeContent (anode,m_agentNode); | 
 |  |  |             SetAgentNode (anode,m_agentNode); | 
 |  |  |          } | 
 |  |  |          else | 
 |  |  |          { | 
 |  |  |             msxml::IXMLDOMElement xframeElement =  GetElement(); | 
 |  |  |             msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); | 
 |  |  |             KXMLDOMElement xframeElement =  GetElement(); | 
 |  |  |             KXMLDOMElement agent = xframeElement.selectSingleNode(L"agent/"+xfNodeAgentArea+L"[1]/*"); | 
 |  |  |             if(agent) | 
 |  |  |             { | 
 |  |  |                string s = agent.xml; | 
 |  |  |                m_agentNode =  SetAgentNodeContent (anode,s); | 
 |  |  |                xstring s = agent.xml(); | 
 |  |  |                m_agentNode =  SetAgentNode (anode,s); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |     | 
 |  |  |       int OnRowChanged(ref TNotifyEvent evt,int p) | 
 |  |  |       int OnRowChanged(TEvent* evt, int p) | 
 |  |  |       { | 
 |  |  |          ref DWNMHDR  hdr = trust(evt.pnmh as ref DWNMHDR); | 
 |  |  |          DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; | 
 |  |  |          int row = hdr.row; | 
 |  |  |          SetAgent(); | 
 |  |  |          return 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       //焦点激活处理函数 | 
 |  |  |       int OnSetFocus(ref TEvent evt,int param) | 
 |  |  |       int OnSetFocus(TEvent* evt, LPARAM param) | 
 |  |  |       { | 
 |  |  |          //重置工具条 | 
 |  |  |          SetAgent(); | 
 |  |  | 
 |  |  |        | 
 |  |  |           | 
 |  |  |       //命令发布函数 | 
 |  |  |       int OnCmdDispatch(string comdid) | 
 |  |  |       int OnCmdDispatch(xstring comdid) | 
 |  |  |       { | 
 |  |  |          if(comdid=="xmImport") | 
 |  |  |          if(comdid==L"xmImport") | 
 |  |  |          { | 
 |  |  |              | 
 |  |  |             Doubleclick(); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          if(comdid=="xmClose") | 
 |  |  |          if(comdid==L"xmClose") | 
 |  |  |          { | 
 |  |  |              | 
 |  |  |             CloseWindow(); | 
 |  |  |             return 1; | 
 |  |  |          } | 
 |  |  |          if(comdid=="xmSearch") | 
 |  |  |          if(comdid==L"xmSearch") | 
 |  |  |          { | 
 |  |  |              | 
 |  |  |             OnRetrieve(GoodsNo); | 
 |  |  | 
 |  |  |        | 
 |  |  |       int Doubleclick() | 
 |  |  |       { | 
 |  |  |          xaserverarg arg = GetParam(); | 
 |  |  |          arg.AddArg("items",""); | 
 |  |  |          string str = ""; | 
 |  |  |          xaserverarg arg = GetArg(); | 
 |  |  |          arg.AddArg(L"items",L""); | 
 |  |  |          xstring str = L""; | 
 |  |  |          int row =  dw_list.GetNextSelectRow(1); | 
 |  |  |          while(row > 0 && row <= dw_list.GetRowCount()) | 
 |  |  |          { | 
 |  |  |             msxml::IXMLDOMElement ele = dw_list.GetRowElement(row); | 
 |  |  |             KXMLDOMElement ele = dw_list.GetRowElement(row); | 
 |  |  |           | 
 |  |  |             str += ele.xml; | 
 |  |  |             str += ele.xml(); | 
 |  |  |             row =  dw_list.GetNextSelectRow(row + 1); | 
 |  |  |          } | 
 |  |  |          if(str != "") | 
 |  |  |             arg.AddArg("items","<data>"+str+"</data>"); | 
 |  |  |          if(str != L"") | 
 |  |  |             arg.AddArg(L"items",L"<data>"+str+L"</data>"); | 
 |  |  |          trace(str); | 
 |  |  |          arg.AddArg("action","ok"); | 
 |  |  |          arg.AddArg(L"action",L"ok"); | 
 |  |  |          CloseWindow(); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |       //命令处理事件 | 
 |  |  |       int OnXCommand(ref TXCommandEvent evt,int param) | 
 |  |  |       int OnXCommand(TEvent* evt, LPARAM param) | 
 |  |  |       { | 
 |  |  |          return OnCmdDispatch(evt.pStrID); | 
 |  |  |          return OnCmdDispatch(evt->xcommand.pStrID); | 
 |  |  |       } | 
 |  |  |           | 
 |  |  |       int OnAttachEvent() | 
 |  |  |       { | 
 |  |  |          //绑定工具条点击事件 | 
 |  |  |          AttachEvent("WM_XCOMMAND",OnXCommand); | 
 |  |  |          AttachEvent(L"WM_XCOMMAND", (FEvent)&CustomerItemNoList::OnXCommand); | 
 |  |  |          //获取焦点事件,用于重置工具条 | 
 |  |  |          AttachEvent("WM_SETFOCUS",OnSetFocus); | 
 |  |  |          AttachEvent("dw_list","DWV_DOUBLECLICKED",Doubleclick); | 
 |  |  |          AttachEvent(L"WM_SETFOCUS", (FEvent)&CustomerItemNoList::OnSetFocus); | 
 |  |  |          AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED", (FEvent)&CustomerItemNoList::Doubleclick); | 
 |  |  |          return 1; | 
 |  |  |           | 
 |  |  |       } | 
 |  |  |        | 
 |  |  |        | 
 |  |  |       int  OnRetrieve(string GoodsNo) | 
 |  |  |       int  OnRetrieve(xstring GoodsNo) | 
 |  |  |       { | 
 |  |  |          xml x = new xml; | 
 |  |  |          x.setNativePointer(xml::CreateInstance()); | 
 |  |  |          xaserverarg arg = new xaserverarg; | 
 |  |  |          arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |          arg.AddArg("GoodsNo",GoodsNo); | 
 |  |  |          xml x ; | 
 |  |  |           | 
 |  |  |          if (getUrl("/sale/data/ProductLibrary3/GetCustomerItemNoList",arg.GetString(),x)!=1) | 
 |  |  |          xaserverarg arg ; | 
 |  |  | 			 | 
 |  |  |          arg.AddArg(L"GoodsNo",GoodsNo); | 
 |  |  | 			 | 
 |  |  |          if (getUrl(L"/sale/data/ProductLibrary3/GetCustomerItemNoList",arg.GetString(),x)!=1) | 
 |  |  |          { | 
 |  |  |             trace(x.GetXmlDoc().text); | 
 |  |  |             trace(x.text()); | 
 |  |  |             return -1; | 
 |  |  |          }else    | 
 |  |  |          { | 
 |  |  | 
 |  |  |           | 
 |  |  |       int onload() | 
 |  |  |       { | 
 |  |  |          dw_list = GetControl("dw_list"); | 
 |  |  |          dw_list.openUrl("/sale/view/Quote3/template/Quote/CustomerItemNoList"); | 
 |  |  |          SetArg(); | 
 |  |  |          dw_list = GetControl(L"dw_list"); | 
 |  |  |          dw_list.openUrl(L"/sale/view/Quote3/template/Quote/CustomerItemNoList"); | 
 |  |  |        | 
 |  |  |           | 
 |  |  |          if(GetParam()) | 
 |  |  |          if(GetWinParam()) | 
 |  |  |          { | 
 |  |  |             xaserverarg arg = GetParam(); | 
 |  |  |             GoodsNo=arg.GetArgString("GoodsNo"); | 
 |  |  |             OnRetrieve(arg.GetArgString("GoodsNo")); | 
 |  |  |             xaserverarg arg = GetArg(); | 
 |  |  |             GoodsNo=arg.GetArgString(L"GoodsNo"); | 
 |  |  |             OnRetrieve(arg.GetArgString(L"GoodsNo")); | 
 |  |  |          } | 
 |  |  |          OnRetrieve(GoodsNo); | 
 |  |  |          OnAttachEvent();    | 
 |  |  | 
 |  |  |           | 
 |  |  |          return 1; | 
 |  |  |       }       | 
 |  |  |    }; | 
 |  |  | ] | 
 |  |  |    }; |