| | |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\AddUser.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\AddUserGroup.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\BindComputer.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Buglist.Developer.hxsoft_A.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Data.config.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Developer.Synch.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Flow3.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\FlowTermImport.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\FlowTermSelect.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\GroupManagerList_A.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\level.Customer.v3.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\LogList.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\maint.Level.Customer3.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Organization_A.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\ProcessManagement_A.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Resource.select.data.config.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Role.config.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\SysLoginRecord.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\SysUser.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\TestRetrieveing.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\UserImport.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\UserPassDlg.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\view.assignadjust.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\VATNotify\list.vatnotify.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | |
| | | <Filter Include="project\business\BasicCode"> |
| | | <UniqueIdentifier>{64c23153-69c8-4db3-9225-9e5375e489ff}</UniqueIdentifier> |
| | | </Filter> |
| | | <Filter Include="project\business\SystemSettings"> |
| | | <UniqueIdentifier>{9d76dee1-2190-4b2c-8f17-bd2e54140f7d}</UniqueIdentifier> |
| | | </Filter> |
| | | </ItemGroup> |
| | | <ItemGroup> |
| | | <ClInclude Include="framework.h"> |
| | |
| | | <ClCompile Include="..\project\business\BasicCode\TypeList.maint.supplier.cpp"> |
| | | <Filter>project\business\BasicCode</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\AddUser.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\AddUserGroup.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\BindComputer.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Buglist.Developer.hxsoft_A.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Data.config.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Developer.Synch.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Flow3.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\FlowTermImport.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\FlowTermSelect.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\GroupManagerList_A.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\level.Customer.v3.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\LogList.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\maint.Level.Customer3.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Organization_A.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\ProcessManagement_A.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Resource.select.data.config.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\Role.config.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\SysLoginRecord.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\SysUser.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\TestRetrieveing.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\UserImport.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\UserPassDlg.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\SystemSettings\view.assignadjust.cpp"> |
| | | <Filter>project\business\SystemSettings</Filter> |
| | | </ClCompile> |
| | | </ItemGroup> |
| | | </Project> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:code[pa.tpp]" |
| | | use "dev:vm[control.vm]" |
| | | #include "dev:xpage[SysUser.vx]" |
| | | |
| | | unit vbusiness.xpage tpp |
| | | [ |
| | | class pa |
| | | { |
| | | string note; |
| | | int hitem; |
| | | int row; |
| | | int wid; |
| | | treeview__ tv; |
| | | xdwgrid__ dw; |
| | | win__ pwin; |
| | | } |
| | | ] |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | AddUser is extend win__; |
| | | about AddUser |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | pa p; |
| | | |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | int SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | int AppendItem(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | //xcontrol xc = GetControl(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | r.appendChild(e); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | control__ xc = new control__; |
| | | /*xc=GetControl("EmployeeNo"); |
| | | if (xc.GetText()=="") |
| | | { |
| | | alert("ç¨æ·ä»£ç ä¸è½ä¸ºç©ºï¼"); |
| | | return 0; |
| | | }*/ |
| | | xc=GetControl("UserName"); |
| | | if (xc.GetText()=="") |
| | | { |
| | | alert("ç¨æ·åç§°ä¸è½ä¸ºç©ºï¼"); |
| | | return 0; |
| | | } |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | x.LoadXml("<SysUser/>"); |
| | | var r = x.GetXmlDoc().documentElement; |
| | | string guid; |
| | | string guid1; |
| | | if (p.note=="ä¿®æ¹") |
| | | { |
| | | msxml::IXMLDOMElement ele=xdwgrid__::GetRowElement(p.row); |
| | | guid = ele.selectSingleNode("UserID").text; |
| | | //guid=ele.getAttribute("guid"); |
| | | //if (ele.selectSingleNode("empid")) |
| | | // r.appendChild(ele.selectSingleNode("empid")); |
| | | } |
| | | else |
| | | guid=win__::GetGuid(); |
| | | //guid1=win32::GetGuid(); |
| | | r.setAttribute("guid",guid); |
| | | //r.setAttribute("guid1",guid1); |
| | | //AppendItem(x,r,"EmployeeNo"); |
| | | AppendItem(x,r,"UserName"); |
| | | AppendItem(x,r,"PassWord"); |
| | | AppendItem(x,r,"Status"); |
| | | //trace(x.GetXml()); |
| | | //return 1; |
| | | arg.AddArg("content",x.GetXml()); |
| | | int ls_item = treeview__::GetSelectedItem(p.wid); |
| | | msxml::IXMLDOMElement e=treeview__::GetItemData(p.wid,ls_item); |
| | | string gpguid=e.selectSingleNode("@guid").text; |
| | | arg.AddArg("gpguid",gpguid); |
| | | if (xaserver__::ExecXAction(GetServerUrl(),"[update.User.xa]",arg.GetString())==1) |
| | | { |
| | | alert("ok"); |
| | | if (p.note=="ä¿®æ¹") |
| | | { |
| | | xdwgrid__ dw = new xdwgrid__; |
| | | //dw.setNativePointer(p.dw_user); |
| | | int row = dw.GetNextSelectRow(0); |
| | | //dw.SetItemString(row,"UserName",""); |
| | | msxml::IXMLDOMElement e; |
| | | e = x.GetXmlDoc().documentElement; |
| | | string ls_pass = e.selectSingleNode("PassWord").text; |
| | | string ls_status = e.selectSingleNode("Status").text; |
| | | dw.SetItemString(row,"PassWord",ls_pass); |
| | | dw.SetItemString(row,"Status",ls_status); |
| | | dw.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | //---------- |
| | | //p.pwin.OnTreeSelChanged(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ClearItem(string item) |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(""); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="cb_cancel") |
| | | CloseWindow(); |
| | | else if(comdid=="cb_ok") |
| | | { |
| | | int r=OnSave(); |
| | | if (r==1) |
| | | CloseWindow(); |
| | | } |
| | | else if(comdid=="cb_save") |
| | | { |
| | | OnSave(); |
| | | p.note="æ°å¢"; |
| | | win__::SetWindowText(GetHWND(),p.note+"ç¨æ·"); |
| | | ClearItem("userno"); |
| | | ClearItem("username"); |
| | | ClearItem("pwd"); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetItem(string value,string item){ |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(value); |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | OnInitial(); |
| | | p = new pa; |
| | | |
| | | if(this.GetParam()) |
| | | { |
| | | p=GetParam(); |
| | | win__::SetWindowText(GetHWND(),p.note+"ç¨æ·"); |
| | | if (p.note=="ä¿®æ¹") |
| | | { |
| | | xdwgrid__ dw = new xdwgrid__; |
| | | dw.setNativePointer(p.dw); |
| | | msxml::IXMLDOMElement ele=dw.GetRowElement(p.row); |
| | | //if(ele.selectSingleNode("EmployeeNo")) |
| | | //SetItem(ele.selectSingleNode("EmployeeNo").text,"EmployeeNo"); |
| | | if(ele.selectSingleNode("UserName")) |
| | | SetItem(ele.selectSingleNode("UserName").text,"UserName"); |
| | | if(ele.selectSingleNode("PassWord")) |
| | | SetItem(ele.selectSingleNode("PassWord").text,"PassWord"); |
| | | if(ele.selectSingleNode("Status")) |
| | | SetItem(ele.selectSingleNode("Status").text,"Status"); |
| | | trace("Aa"); |
| | | return 1; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:code[pa.tpp]" |
| | | use "dev:vm[control.vm]" |
| | | |
| | | unit vbusiness.xpage tpp |
| | | [ |
| | | class pa |
| | | { |
| | | string note; |
| | | int hitem; |
| | | int row; |
| | | int wid; |
| | | treeview__ tv; |
| | | xdwgrid__ dw; |
| | | win__ pwin; |
| | | } |
| | | ] |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | |
| | | AddUserGroup is extend win__; |
| | | about AddUserGroup |
| | | [ |
| | | control: |
| | | |
| | | method: |
| | | [ |
| | | pa p; |
| | | |
| | | int SetAgent() |
| | | { |
| | | return 1; |
| | | } |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | int SetAgent(); |
| | | |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | int AppendItem(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | r.appendChild(e); |
| | | return 1; |
| | | } |
| | | int AppendAttrib(xml__ x,msxml::IXMLDOMElement r,string item){ |
| | | var e = x.GetXmlDoc().createElement(item); |
| | | //xcontrol xc = GetControl(item); |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl(item)); |
| | | e.text = xc.GetText(); |
| | | r.setAttribute(item,xc.GetText()); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="cb_cancel") |
| | | CloseWindow(); |
| | | else if(comdid=="cb_ok") |
| | | { |
| | | int wid = p.wid; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | x.LoadXml("<row/>"); |
| | | var r = x.GetXmlDoc().documentElement; |
| | | string gpguid; |
| | | if (p.note=="ä¿®æ¹") |
| | | { |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,p.hitem); |
| | | gpguid=ele.selectSingleNode("@JobID").text; |
| | | } |
| | | else |
| | | gpguid=win__::GetGuid(); |
| | | r.setAttribute("JobID",gpguid); |
| | | AppendAttrib(x,r,"JobName"); |
| | | AppendAttrib(x,r,"JobType"); |
| | | //AppendItem(x,r,"JobName"); |
| | | //AppendItem(x,r,"JobType"); |
| | | //trace(x.GetXml()); |
| | | //return 1; |
| | | arg.AddArg("content",x.GetXml()); |
| | | if (xaserver__::ExecXAction(GetServerUrl(),"[update.Usergroup.xa]",arg.GetString())==1) |
| | | { |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(this.GetControl("JobName")); |
| | | //p.tv.Redraw(); |
| | | if (p.note=="ä¿®æ¹") |
| | | { |
| | | treeview__::SetItemData(wid,p.hitem,r); |
| | | treeview__::SetItemLabel(wid,p.hitem,xc.GetText()); |
| | | } |
| | | else |
| | | { |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::InsertChildItem(wid,root,xc.GetText(),r,15); |
| | | } |
| | | CloseWindow(); |
| | | } |
| | | else |
| | | { |
| | | alert("ä¿ååºé!"); |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetItem(string value,string item){ |
| | | control__ xc = new control__; |
| | | xc.setNativePointer(GetControl(item)); |
| | | xc.SetText(value); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnInitial(); |
| | | p = new pa; |
| | | |
| | | if(this.GetParam()) |
| | | { |
| | | p=GetParam(); |
| | | win__::SetWindowText(GetHWND(),p.note+"ç¨æ·ç»"); |
| | | if (p.note=="ä¿®æ¹") |
| | | { |
| | | int wid = p.wid; |
| | | msxml::IXMLDOMElement ele=treeview__::GetItemData(wid,p.hitem); |
| | | //trace(ele.xml); |
| | | //SetItem(ele.selectSingleNode("gpno").text,"gpno"); |
| | | //SetItem(ele.selectSingleNode("gpname").text,"gpname"); |
| | | string ls_guid = ele.selectSingleNode("@JobID").text; |
| | | string ls_name = ele.selectSingleNode("@JobName").text; |
| | | string ls_type = ele.selectSingleNode("@JobType").text; |
| | | SetItem(ls_guid,"JobID"); |
| | | SetItem(ls_name,"JobName"); |
| | | SetItem(ls_type,"JobType"); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use"lang.vl" |
| | | use "win.vl" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | BindComputerDlgNew is extend win__; |
| | | about BindComputerDlgNew |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | xdwgrid__ dw_list; |
| | | int OnRetrieve() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | if(arg.GetArgString("BindComputer")) |
| | | { |
| | | string sbys= arg.GetArgString("BindComputer"); |
| | | //alert(sbys); |
| | | x.LoadXml(sbys); |
| | | |
| | | } |
| | | else |
| | | { |
| | | |
| | | x.LoadXml("<args></args>"); |
| | | } |
| | | |
| | | dw_list.Retrieve(x.GetXmlDoc().selectSingleNode("args")); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | int OnAddRow(xdwgrid__ dw) |
| | | { |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRow(xdwgrid__ dw) |
| | | { |
| | | int row = dw.GetRow(); |
| | | if(row<1 || row > dw.GetRowCount()) return -1; |
| | | dw.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | dw_list.AcceptText(); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = win__::GetParam(); |
| | | arg.AddArg("comdid",comdid); |
| | | if (comdid=="ok") |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllTo(x.GetXmlDoc()); |
| | | arg.AddArg("xml",x.GetXml()); |
| | | CloseWindow(); |
| | | } |
| | | else if(comdid=="close") |
| | | CloseWindow(); |
| | | else if(comdid == "add") |
| | | OnAddRow(dw_list); |
| | | else if(comdid == "del") |
| | | OnDelRow(dw_list); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | } |
| | | int onload() |
| | | { |
| | | OnAttachEvent(); |
| | | |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(GetControl("dw_list")); |
| | | dw_list.SetDataObject(GetServerUrl(),"dev:sheet[SysUser.tpl/BindComputer]"); |
| | | dw_list.SetReadOnly(true); |
| | | if(this.GetParam()) |
| | | { |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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: |
| | | ProductLibrary4Win(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ProductLibrary4Win* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ProductLibrary4Win* pWin = new ProductLibrary4Win(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | 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 KXMLDOMElement(); |
| | | KXMLDOMElement e = dw_list.GetRowElement(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 = dw_list.GetGuid(row); |
| | | 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 = dw_list.GetItemString(row, L"SKUID"); |
| | | xstring customerItemNo =dw_list.GetItemString( 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 = dw_list.GetGuid(row); |
| | | |
| | | 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 = dw_list.GetItemString(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'>" + dw_list.GetItemString( row, (LPCTSTR)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 (dw_list.GetItemString( row, (LPCTSTR)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>" + dw_list.GetItemString( row, (LPCTSTR)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 (dw_list.GetItemString( 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' >" + dw_list.GetItemString( 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 >" +dw_list.GetItemString( row, (LPCTSTR)name) + L"</td>"; |
| | | html += L"</tr>"; |
| | | } |
| | | |
| | | html += L"<tr>"; |
| | | html += L"<td rowspan='3'>" +dw_list.GetItemString( row, L"PackCode") + L"</td><td >å
è£
æ¹å¼</td><td >" + |
| | | dw_list.GetItemString(row, L"CPack") + L"</td>"; |
| | | html += L"</tr>"; |
| | | html += L"<tr height='48'>"; |
| | | html += L"<td >å
è£
è¦æ±</td><td >" +dw_list.GetItemString( 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>" +dw_list.GetItemString( row, L"QualityCode") + L"</td><td >è´¨éè¦æ±</td><td >" + |
| | | dw_list.GetItemString(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", 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 = dw_list.GetRowElement(row); |
| | | xstring skuid = dw_list.GetItemString( row, L"@guid"); |
| | | xstring SKUNo = dw_list.GetItemString( 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 ; |
| | | x.loadXML(L"<Item update.new='1' update.modify='1' guid='" + id + L"'>" + |
| | | L"<ProductPictureID>" + id + L"</ProductPictureID>" + |
| | | L"<OriginFile>" + originfile + L"</OriginFile>" + |
| | | L"<FileExt>" + ext + L"</FileExt>" + |
| | | L"<SKUID>" + skuid + L"</SKUID>" + |
| | | L"<Name>[" + SKUNo.trim() + L"]</Name>" + |
| | | L"<FileName>" + id + L".jpg</FileName>" + |
| | | L"</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xurl::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 = dw_list.GetRowElement( row); |
| | | xstring skuid =dw_list.GetItemString( row, L"SKUID"); |
| | | xstring SKUNo =dw_list.GetItemString( row, L"SKUID/@__displaystring"); |
| | | xstring CustomerID = m_customer; |
| | | xstring CustomerItemNo =dw_list.GetItemString( 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; |
| | | x.loadXML(L"<Item update.new='1' update.modify='1' guid='" + id + L"'>" + |
| | | L"<ProductPictureID>" + id + L"</ProductPictureID>" + |
| | | L"<OriginFile>" + originfile + L"</OriginFile>" + |
| | | L"<FileExt>" + ext + L"</FileExt>" + |
| | | L"<SKUID>" + skuid + L"</SKUID>" + |
| | | L"<CustomerItemNo>" + CustomerItemNo + L"</CustomerItemNo>" + |
| | | L"<CustomerID>" + CustomerID + L"</CustomerID>" + |
| | | L"<Name>[" + SKUNo.trim() + L"]</Name>" + |
| | | L"<FileName>" + id + L".jpg</FileName>" + |
| | | L"</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xurl::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 (MessageBox(GetHWND(), L"确认å é¤å½åå¾ç?", L"æç¤º", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | xstring id = images.item(index).selectSingleNode(L"@guid").text(); |
| | | |
| | | xml x ; |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; |
| | | arg.AddArg(L"content", str); |
| | | if (xurl::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 =dw_list.GetItemString( row, L"SKUID"); |
| | | xstring SKUNo =dw_list.GetItemString( row, L"SKUID/@__displaystring"); |
| | | xstring CustomerID = m_customer; |
| | | xstring CustomerItemNo =dw_list.GetItemString( 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 (MessageBox(GetHWND(), L"确认å é¤å½åå¾ç?", L"æç¤º", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | xstring id = images.item(index).selectSingleNode(L"@guid").text(); |
| | | |
| | | xml x; |
| | | xaserverarg arg; |
| | | xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; |
| | | arg.AddArg(L"content", str); |
| | | if (xurl::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 = dw_list.GetRowElement(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 = dw_list.GetRowElement(row); |
| | | //KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | //alert(e.xml); |
| | | xstring id = dw_list.GetItemString( row, L"@guid"); |
| | | //alert(id); |
| | | |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | xstring categoryid = e1.selectSingleNode(L"@guid").text(); |
| | | //alert(categoryid); |
| | | xaserverarg* arg = new xaserverarg; |
| | | arg->AddArg(L"SKUID", id); |
| | | arg->AddArg(L"CategoryID", categoryid); |
| | | |
| | | OpenWindow(L"dev:xpage[PictureView.Product3.vx]", (LPARAM)arg); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ItemMaint() |
| | | { |
| | | HTREEITEM 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); |
| | | #ifdef shouldfinished |
| | | int pr = g_xdoc_product; |
| | | OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", pr); |
| | | #endif |
| | | return 1; |
| | | } |
| | | |
| | | int ItemAdd() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM 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; |
| | | 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); |
| | | OpenWindow(L"dev:xpage[Quick.Input.NewProduct.vx]", (LPARAM)&arg); |
| | | |
| | | if (arg.GetArgString(L"data.modify") == L"1")RetrieveData(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddFolder() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | |
| | | xaserverarg arg; |
| | | 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]",(LPARAM)&arg); |
| | | /*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() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | |
| | | xaserverarg arg; |
| | | 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]", (LPARAM)&arg); |
| | | 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") |
| | | { |
| | | #ifdef shouldfinish |
| | | OpenWindow(L"dev:xpage[ShoppingCartProductMaint.vx]", trust(g_xdoc_shoppingcart as int)); |
| | | #endif |
| | | 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.setNativePointer(carg.CreateInstance()); |
| | | 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.setNativePointer(carg.CreateInstance()); |
| | | 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"xmSearch") |
| | | { |
| | | RetrieveData(); |
| | | 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; |
| | | xstring skuid = dw_list.GetItemString( 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 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") |
| | | { |
| | | #ifdef shouldfinish |
| | | int r = cast(g_xdoc_product.getData(L"data/Item", L"@guid") as int); |
| | | OpenWindow(L"dev:xpage[Product.ItemProp.Maint.vx]", r); |
| | | #endif |
| | | 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 = 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 =dw_list.GetRowElement(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(TEvent* evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | //æ¥æ¾å½åæ 项ç顶级ç®å½ |
| | | 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 = 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, 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 MakeUserGoodsFolderItem(HTREEITEM 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; |
| | | |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, label, 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 = nlist.item(i); |
| | | xstring name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, 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 = nlist.item(i); |
| | | xstring name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, 35); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandItem(HTREEITEM 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""; |
| | | 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) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | return ExpandItem(hItem); |
| | | } |
| | | |
| | | int ResetAgent(xstring agentAsk) |
| | | { |
| | | if (agentFor != agentAsk) |
| | | { |
| | | agentFor = agentAsk; |
| | | m_agentNode = 0; |
| | | SetAgent(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | HTREEITEM LookupCustomerFolder(HTREEITEM hItem) |
| | | { |
| | | while (true) |
| | | { |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | 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(HTREEITEM hItem) |
| | | { |
| | | hItem = LookupCustomerFolder(hItem); |
| | | if (hItem == 0) return L""; |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | xstring str = e1.getAttribute(L"no"); |
| | | return str.mid(xstring(L"Customer:").length(), 9999); |
| | | } |
| | | |
| | | int RetrieveData() |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM 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.Reset(); |
| | | im.Redraw(); |
| | | |
| | | |
| | | xshtml 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; |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | if (name == L"è´ç©è½¦") |
| | | { |
| | | if (selectname != name) |
| | | { |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | 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); |
| | | dw_list.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); |
| | | } |
| | | else if (e1.getAttribute(L"categoryid") != L"") |
| | | { |
| | | xstring categoryid = e1.getAttribute(L"categoryid"); |
| | | dwc_list.SetDataObject(ProductLibraryView::GetMaintListForm3(categoryid)); |
| | | dwc_list.SetReadOnly(true); |
| | | dwc_list.Reset(); |
| | | dw_list.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(); |
| | | dw_list.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); |
| | | } |
| | | //dwc_list.PostRetrieve(); |
| | | dwc_list.Redraw(); |
| | | |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | if (dwc_list.GetRowCount() >= 1) |
| | | { |
| | | xs.SetContent(makeGoodscarHtml(1)); |
| | | |
| | | if (m_customer != L"") |
| | | { |
| | | xstring skuid =dw_list.GetItemString( 1, L"SKUID"); |
| | | xstring customerItemNo =dw_list.GetItemString( 1, L"CustomerItemNo"); |
| | | OnShowImage(skuid, customerItemNo); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | im.Reset(); |
| | | 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"); |
| | | } |
| | | else |
| | | return 1; |
| | | |
| | | /* dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(no).GetXmlDoc()); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.Reset(); |
| | | dw_list.SetReadOnly(true); |
| | | */ |
| | | |
| | | if (name == L"个人åº") |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintRoleList3(no)); |
| | | else |
| | | { |
| | | if (queryString != L"") |
| | | { |
| | | |
| | | if (no == L"N000005") |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintList3(L"", queryString, L"")); |
| | | else |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintList3(no, queryString, L"")); |
| | | } |
| | | else |
| | | { |
| | | if (no == L"N000005") return 1; |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintList3(no)); |
| | | } |
| | | } |
| | | //dw_list.PostRetrieve(); |
| | | dw_list.Redraw(); |
| | | |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | if (dw_list.GetRowCount() > 0) |
| | | { |
| | | xs.SetContent(makeHtml(1)); |
| | | xstring id = dw_list.GetItemString( 1, L"@guid"); |
| | | OnShowImage(id); |
| | | } |
| | | else |
| | | { |
| | | im.Reset(); |
| | | im.Redraw(); |
| | | |
| | | 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) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | HTREEITEM 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(); |
| | | PostMessage(GetHWND(), 0x401, (WPARAM)L"xmRefresh", 0); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | 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, 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 OnViewZoomChange(TEvent* evt, int lParam) |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | xcombobox xc = GetControl(L"precent"); |
| | | xstring text = xc.GetLBText(); |
| | | int p = text.toInt(); |
| | | if (p == 0) p = 100; |
| | | im.Preview(p); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ProductLibrary4Win::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ProductLibrary4Win::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductLibrary4Win::OnRowChanged); |
| | | AttachEvent(L"dwc_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductLibrary4Win::OnGoodsCarRowChanged); |
| | | AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING", (FEvent)&ProductLibrary4Win::OnTreeExpanding); |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&ProductLibrary4Win::OnTreeSelChanged); |
| | | AttachEvent(L"WM_COMMAND", (FEvent)&ProductLibrary4Win::OnCkbCLick); //checkboxæé©äºä»¶ |
| | | AttachEvent(L"WM_COMMAND", (FEvent)&ProductLibrary4Win::OnCkbCLick2); //checkboxæé©äºä»¶ |
| | | |
| | | AttachEvent(L"im1", L"IMG_LDBCLICK", (FEvent)&ProductLibrary4Win::OnImgDBClicked); |
| | | AttachEvent(L"precent", L"CBN_SELCHANGE", (FEvent)&ProductLibrary4Win::OnViewZoomChange); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | agentFor = L"goodslib"; |
| | | m_customer = 0; |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dwc_list = GetControl(L"dwc_list"); |
| | | |
| | | InitialFolder(); |
| | | |
| | | dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"")); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodslist"); |
| | | dwc_list.SetReadOnly(true); |
| | | |
| | | tv_folder.ExpandItem(tv_folder.GetRootItem()); |
| | | tv_folder.ItemFocus(tv_folder.GetRootItem()); |
| | | |
| | | if (dw_list.GetRowCount()) |
| | | { |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnImgDBClicked(TEvent * evt, int pr) |
| | | { |
| | | IMGNNMHDR& nmtv = *(IMGNNMHDR*)evt->notify.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.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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "lang.vl" |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[combobox.vm]" |
| | | use "frame.vl" |
| | | use "file.vl" |
| | | use "dev:vm[xlayersheet.vm]" |
| | | use "publiccode.vl" |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | DataConfig is extend frame; |
| | | about DataConfig |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | treeview__ dw_tree; |
| | | xdwgrid__ dw_list; |
| | | xdwgrid__ dw_role; |
| | | combobox__ dw_ddlb; |
| | | xlayersheet__ m_sheet; |
| | | |
| | | int alert(string str) |
| | | { |
| | | TApp::alert(this,str,3); |
| | | return 0; |
| | | } |
| | | int createTree(msxml::IXMLDOMElement e, int parentItem) |
| | | { |
| | | if(treeview__::GetChildItem(dw_tree.GetId(), parentItem) > 0) return 0; |
| | | |
| | | var list=e.selectNodes("item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(s - i - 1); |
| | | string Name=xitem.selectSingleNode("name").text; |
| | | string image = xitem.selectSingleNode("image").text; |
| | | int curItem=treeview__::InsertItem(dw_tree.GetId(), parentItem,0,Name,xitem,image.toInt()); |
| | | string child=xitem.selectSingleNode("child").text; |
| | | if (child != "0") |
| | | treeview__::SetItemChild1(dw_tree.GetId(), curItem,1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | int i = combobox__::GetCurSel(dw_ddlb.GetId()); |
| | | msxml::IXMLDOMElement e = treeview__::GetItemData(dw_tree.GetId(), sitem); |
| | | string id = e.selectSingleNode("id").text; |
| | | string xid = e.selectSingleNode("tree").text; |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("pid",id); |
| | | arg.AddArg("tree",xid); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/user/select",arg.GetString(),x)!=1) |
| | | { |
| | | trace("é误è¿å="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | createTree(ele, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string id) |
| | | { |
| | | int hIcon= xutil__::SetCursorWait(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id",id); |
| | | trace(id); |
| | | arg.AddArg("flag","-1"); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/maint/data",arg.GetString(),x)!=1) |
| | | { |
| | | trace("é误è¿å1="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | |
| | | if(x.GetXml() == "") |
| | | x.LoadXml("<root><items/><roles/></root>"); |
| | | |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(xml__ ::CreateInstance()); |
| | | if(x.GetXmlDoc().selectSingleNode("root/items")) |
| | | { |
| | | dw_list.Retrieve(x.GetXmlDoc().selectSingleNode("root/items")); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | x1.LoadXml("<items/>"); |
| | | dw_list.Retrieve(x1); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.Redraw(); |
| | | } |
| | | if(x.GetXmlDoc().selectSingleNode("root/roles")) |
| | | { |
| | | dw_role.Retrieve(x.GetXmlDoc().selectSingleNode("root/roles")); |
| | | dw_role.SetReadOnly(true); |
| | | dw_role.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | x1.LoadXml("<roles/>"); |
| | | dw_role.Retrieve(x1); |
| | | dw_role.SetReadOnly(true); |
| | | dw_role.Redraw(); |
| | | } |
| | | xutil__::RestoreCursor(hIcon); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelecded( ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int wid = dw_tree.GetId(); |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(wid,hItem); |
| | | |
| | | string id = ele.SelectSingleNode("id").text; |
| | | OnRetrieve(id); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelect() |
| | | { |
| | | int nIndex = combobox__::GetCurSel(dw_ddlb.GetId()); |
| | | |
| | | combobox__ dw_ddlbdata = new combobox__; |
| | | dw_ddlbdata.setNativePointer(this.GetControl("dw_ddlbdata")); |
| | | int h = combobox__::FindString(dw_ddlbdata.GetId(), nIndex.toString()); |
| | | param p; |
| | | xnode__ bnode; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode("tree")); |
| | | if(h < 0) |
| | | { |
| | | string str = "<vbox><xtree name='dw_tree"+nIndex.toString()+"' imagelist='0'/></vbox>"; |
| | | bnode = new xnode__; |
| | | bnode.setNativePointer(SetAgentNodeContent(anode,str)); |
| | | |
| | | p = combobox__::GetItemData(dw_ddlb.GetId(), nIndex); |
| | | msxml::IXMLDOMElement ele = p; |
| | | |
| | | dw_tree = new treeview__; |
| | | dw_tree.setNativePointer(this.GetControl("dw_tree"+nIndex.toString())); |
| | | |
| | | createTree(ele, 0); |
| | | AttachEvent("dw_tree"+nIndex.toString(), "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | AttachEvent("dw_tree"+nIndex.toString(), "TVN_SELCHANGED",OnTreeSelecded); |
| | | |
| | | int sk = combobox__::AddItem(dw_ddlbdata.GetId(), nIndex.toString()); |
| | | p = bnode; |
| | | combobox__::SetItemData(dw_ddlbdata.GetId(), sk, p); |
| | | } |
| | | else |
| | | { |
| | | p = combobox__::GetItemData(dw_ddlbdata.GetId(), h); |
| | | bnode = p; |
| | | SetAgentNodeContent(anode,bnode); |
| | | |
| | | dw_tree = new treeview__; |
| | | dw_tree.setNativePointer(this.GetControl("dw_tree"+nIndex.toString())); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(m == 0) return 0; |
| | | |
| | | int wid = dw_tree.GetId(); |
| | | int hItem=treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(wid,hItem); |
| | | string id = ele.SelectSingleNode("id").text; |
| | | string tpy = ele.SelectSingleNode("type").text; |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | e.SetAttribute("id", id); |
| | | e.SetAttribute("type", tpy); |
| | | |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_role.DwUpdateAllToEx(x1.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e1 = x1.GetXmlDoc().documentElement; |
| | | e.AppendChild(e1); |
| | | |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", e.xml); |
| | | arg.AddArg("dbmap", "Data.config.dbmap"); |
| | | //if(xaserver__::ExecXAction(GetServerUrl(),"[onSave.xa]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/save",arg.GetString(),x)!=1) |
| | | //if(url::get("/workflow/action/datarole.resource/bill.update",arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | } |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_role.ResetUpdateStatus(); |
| | | alert("ä¿åæå!"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectDdlb(ref TNotifyEvent evt,int p) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | if(e) |
| | | { |
| | | var list = e.SelectNodes("//*[@update.new='1' or @update.modify='1' or @update.delete='1']"); |
| | | int s = list.length; |
| | | if(s>0) |
| | | { |
| | | int ret = win__::MessageBox(this.GetHWND(), "å½åä¿®æ¹è®°å½æªä¿åï¼æ¯å¦ä¿åï¼","æç¤º",4); |
| | | if(ret == 6) |
| | | OnSave(); |
| | | } |
| | | } |
| | | |
| | | OnSelect(); |
| | | |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | string id; |
| | | if(m == 0) |
| | | { |
| | | id = ""; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(dw_tree.GetId(),m); |
| | | id = ele.SelectSingleNode("id").text; |
| | | } |
| | | OnRetrieve(id); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int createTreeRoot() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("pid",""); |
| | | arg.AddArg("tree","0"); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[selectRoleInt.xq]",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/user/select",arg.GetString(),x)!=1) |
| | | { |
| | | trace("é误è¿å="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | var list = e.SelectNodes("*"); |
| | | int i; |
| | | int len = list.length; |
| | | msxml::IXMLDOMElement ele; |
| | | for(i=0; i<len; i++) |
| | | { |
| | | ele= list.item(i); |
| | | string name = ele.selectSingleNode("@tree").text; |
| | | int sk = combobox__::AddItem(dw_ddlb.GetId(), name); |
| | | param p = ele; |
| | | combobox__::SetItemData(dw_ddlb.GetId(), sk, p); |
| | | } |
| | | if(len > 0) |
| | | { |
| | | combobox__::SetCurSel(dw_ddlb.GetId(), 0); |
| | | OnSelect(); |
| | | } |
| | | OnRetrieve(""); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | SetAgent("data"); |
| | | return 1; |
| | | } |
| | | |
| | | string GetPath() |
| | | { |
| | | int h = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(h == 0) return 0; |
| | | |
| | | int tv = dw_tree.GetId(); |
| | | string str = treeview__::GetItemLabel(tv, h); |
| | | int k = treeview__::GetParentItem(tv, h); |
| | | while(k > 0) |
| | | { |
| | | string tmp = treeview__::GetItemLabel(tv, k); |
| | | str = tmp+"\\" + str; |
| | | k = treeview__::GetParentItem(tv, k); |
| | | } |
| | | return str; |
| | | } |
| | | |
| | | int OnAddRole() |
| | | { |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(m == 0) return -1; |
| | | msxml::IXMLDOMElement ele =treeview__::GetItemData(dw_tree.GetId(),m); |
| | | string tpy=""+ele.selectSingleNode("type").text; |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("dataUrl","/sale/data/Role.config/pref/model/select"); |
| | | openUrl("/sale/view/Role.config/xpage/role/select/user", arg); |
| | | string str = arg.GetArgString("item"); |
| | | if(str == "") return -1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | x.LoadXml(str); |
| | | var list=x.GetXmlDoc().selectNodes("items/item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | int row = dw_role.GetRowCount() + 1; |
| | | string treepath = GetPath(); |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | string id = ""+xitem.selectSingleNode("@id").text; |
| | | string name=""+xitem.selectSingleNode("@name").text; |
| | | //string tpy=""+xitem.selectSingleNode("@type").text; |
| | | dw_role.InsertRow(0); |
| | | dw_role.SetItemString(row + i, "id", id); |
| | | dw_role.SetItemString(row + i, "name", ""+treepath); |
| | | dw_role.SetItemDisplayString(row + i, "name", name); |
| | | dw_role.SetItemString(row + i, "type", tpy); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow() |
| | | { |
| | | int m = treeview__::GetSelectedItem(dw_tree.GetId()); |
| | | if(m == 0) return 0; |
| | | |
| | | int k = m_sheet.GetSheetIndex(); |
| | | if(k == 0) |
| | | //openUrl("/sale/view/role.config/xpage/data/select/resource", dw_list); |
| | | OpenWindow("dev:xpage[Resource.select.data.config.vx]", dw_list); |
| | | else |
| | | OnAddRole(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRow() |
| | | { |
| | | int k = m_sheet.GetSheetIndex(); |
| | | int row; |
| | | string hr_type; |
| | | msxml::IXMLDOMElement e; |
| | | if(k == 0) |
| | | { |
| | | row = dw_list.GetRow(); |
| | | if(row<1 || row > dw_list.GetRowCount()) return -1; |
| | | e = dw_list.GetRowElement(row); |
| | | if(e.selectSingleNode("fromparent")) |
| | | { |
| | | hr_type = e.selectSingleNode("fromparent").text; |
| | | if(hr_type != "") |
| | | { |
| | | alert("ç»§æ¿çæéæ æå é¤ï¼"); |
| | | return 0; |
| | | } |
| | | } |
| | | dw_list.DeleteRow(row); |
| | | } |
| | | else |
| | | { |
| | | row = dw_role.GetRow(); |
| | | if(row<1 || row > dw_role.GetRowCount()) return -1; |
| | | e = dw_role.GetRowElement(row); |
| | | if(e.selectSingleNode("fromparent")) |
| | | { |
| | | hr_type = e.selectSingleNode("fromparent").text; |
| | | if(hr_type != "") |
| | | { |
| | | alert("ç»§æ¿çæéæ æå é¤ï¼"); |
| | | return 0; |
| | | } |
| | | } |
| | | dw_role.DeleteRow(row); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetCopy(xdwgrid__ dw, msxml::IXMLDOMElement e, string name) |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | msxml::IXMLDOMElement ele; |
| | | bool f = false; |
| | | |
| | | int count = dw.GetRowCount(); |
| | | if(count == 0) |
| | | { |
| | | x.LoadXml("<" + name + "s/>"); |
| | | ele = x.GetXmlDoc().documentElement; |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement e1 = dw.GetRowElement(1); |
| | | ele = e1.parentNode; |
| | | } |
| | | var li = e.SelectNodes(name); |
| | | int i; |
| | | int len = li.length; |
| | | string treepath = GetPath(); |
| | | for(i=0; i<len; i++) |
| | | { |
| | | msxml::IXMLDOMElement ele1= li.item(i); |
| | | if(ele1.selectSingleNode("fromparent")) |
| | | { |
| | | string str = ele1.selectSingleNode("fromparent").text; |
| | | if(str != "") continue; |
| | | } |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(xml__::CreateInstance()); |
| | | x1.LoadXml(ele1.xml); |
| | | msxml::IXMLDOMElement ele2 = x1.GetXmlDoc().documentElement; |
| | | ele2.setAttribute("update.new","1"); |
| | | ele2.setAttribute("update.modify","1"); |
| | | ele2.setAttribute("guid",publiccode::GetGuid()); |
| | | if(ele2.selectSingleNode("name")) |
| | | ele2.selectSingleNode("name").text = treepath; |
| | | //ele1.selectSingleNode("@guid").text = publiccode::GetGuid(); |
| | | //ele1.selectSingleNode("@update.new").text = "1"; |
| | | //ele1.selectSingleNode("@update.modify").text = "1"; |
| | | ele.appendChild(ele2); |
| | | } |
| | | dw.Retrieve(ele); |
| | | dw.SetReadOnly(true); |
| | | dw.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCopy() |
| | | { |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | int p = arg.__nativept; |
| | | OpenWindow("dev:xpage[Data.config.copy.vx]", p); |
| | | string id = arg.GetArgString("id"); |
| | | string f = arg.GetArgString("flag"); |
| | | if(id == "") return 1; |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | if(url::get("/sale/data/Role.config/pref/maint/data",arg.GetString(),x)!=1) |
| | | { |
| | | trace("é误è¿å="+x.GetXml()); |
| | | return -1; |
| | | } |
| | | |
| | | if(x.GetXml() == "") |
| | | x.LoadXml("<root><items/><roles/></root>"); |
| | | |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | |
| | | if(f == "0" || f == "1") |
| | | { |
| | | msxml::IXMLDOMElement ele1 = e.selectSingleNode("items"); |
| | | OnSetCopy(dw_list, ele1, "item"); |
| | | } |
| | | |
| | | if(f == "0" || f == "2") |
| | | { |
| | | msxml::IXMLDOMElement ele2 = e.selectSingleNode("roles") |
| | | OnSetCopy(dw_role, ele2, "role"); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid == "Config") |
| | | openUrl("/sale/view/role.config/xpage/data/resource/config"); |
| | | if(comdid == "RightQuery") |
| | | openUrl("/sale/view/role.config/xpage/data/modulerightquery"); |
| | | else if(comdid == "New") |
| | | OnAddRow(); |
| | | else if(comdid == "Del") |
| | | OnDelRow(); |
| | | else if(comdid == "Save") |
| | | OnSave(); |
| | | else if(comdid == "Copy") |
| | | OnCopy(); |
| | | else if(comdid == "xmProdDivi") |
| | | openUrl("/sale/view/RoleAccount3/xpage/data/proddivi"); |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | SetAgent("data"); |
| | | |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(GetControl("dw_list")); |
| | | dw_list.openUrl("/sale/view/Role.config/template/data/config/resourceOrg"); |
| | | dw_list.SetReadOnly(false); |
| | | |
| | | dw_role = new xdwgrid__; |
| | | dw_role.setNativePointer(GetControl("dw_role")); |
| | | //dw_role.SetDataObject(GetServerUrl(), "dev:sheet[leftFrame.tpl/role]"); |
| | | //dw_role.openUrl(m_vface+"/template/role/config/role"); |
| | | dw_role.openUrl("/sale/view/Role.config/template/role/config/role"); |
| | | dw_role.SetReadOnly(false); |
| | | |
| | | dw_ddlb = new combobox__; |
| | | dw_ddlb.setNativePointer(this.GetControl("dw_ddlb")); |
| | | |
| | | m_sheet = new xlayersheet__; |
| | | m_sheet.setNativePointer(this.GetControl("m_sheet")); |
| | | |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_ddlb","CBN_SELCHANGE",OnSelectDdlb); |
| | | |
| | | createTreeRoot(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class DeveloperSynch : public xframe |
| | | { |
| | | xtreeview tv_gs; |
| | | xsedit dw_log; |
| | | |
| | | int[100] nItems; |
| | | int nCount; |
| | | |
| | | string sContent; |
| | | |
| | | string ProcessDevCmd(string cmd,string ext, string aurl="", bool needlogin=false) |
| | | { |
| | | if(aurl == "") aurl = GetServerUrl(); |
| | | //alert(aurl); |
| | | string d = xaserver::ProcessCmd(aurl,"uri.hxsoft.com/xaserver/developer "+cmd,ext,needlogin); |
| | | return d; |
| | | } |
| | | |
| | | string ProcessDevCmd2(string cmd,string ext, string aurl="", bool needlogin=false) |
| | | { |
| | | if(aurl == "") aurl = GetServerUrl(); |
| | | //alert(aurl); |
| | | string d = xaserver::ProcessCmd(aurl,"uri.hxsoft.com/xaserver/dev:"+cmd,ext,needlogin); |
| | | return d; |
| | | } |
| | | |
| | | int GetProjectItem(int hItem) |
| | | { |
| | | int pitem = hItem; |
| | | string typ; |
| | | while(true) |
| | | { |
| | | int h = xtreeview::GetItemData(tv_gs.GetId(), pitem); |
| | | msxml::IXMLDOMElement e = trust(h as msxml::IXMLDOMElement); |
| | | typ = GetEleString(e, "@tagname"); |
| | | if(typ=="project")break; |
| | | pitem = xtreeview::GetParentItem(tv_gs.GetId(), pitem); |
| | | if(pitem<=0)break; |
| | | } |
| | | return pitem; |
| | | } |
| | | |
| | | int GetP2Item(int hItem) |
| | | { |
| | | int hDomainItem; |
| | | int hP2Item = hItem; |
| | | while(true) |
| | | { |
| | | hDomainItem = xtreeview::GetParentItem(tv_gs.GetId(), hP2Item); |
| | | if(xtreeview::GetParentItem(tv_gs.GetId(), hDomainItem)<=0)break; |
| | | hP2Item = hDomainItem; |
| | | } |
| | | return hP2Item; |
| | | } |
| | | |
| | | string GetItemGuid(int hItem) |
| | | { |
| | | int h = xtreeview::GetItemData(tv_gs.GetId(), hItem); |
| | | msxml::IXMLDOMElement e = trust(h as msxml::IXMLDOMElement); |
| | | string guid = e.GetAttribute("guid"); |
| | | return guid; |
| | | } |
| | | |
| | | xaserverarg GetDataArg(int hItem, xaserverarg arg) |
| | | { |
| | | int h = xtreeview::GetItemData(tv_gs.GetId(), hItem); |
| | | msxml::IXMLDOMElement e = trust(h as msxml::IXMLDOMElement); |
| | | string node = GetEleString(e, "@tagname"); |
| | | //WriteLog(e.xml); |
| | | if(node=="File" || node=="file") |
| | | { |
| | | string caption = e.getAttribute("caption"); |
| | | |
| | | int hP2Item = 0; |
| | | int hDomainItem = 0; |
| | | if(xtreeview::GetParentItem(tv_gs.GetId(), hItem)<=0) |
| | | { |
| | | hDomainItem = hItem; |
| | | }else |
| | | { |
| | | hP2Item = GetP2Item(hItem); |
| | | hDomainItem = xtreeview::GetParentItem(tv_gs.GetId(), hP2Item); |
| | | } |
| | | |
| | | //find project folder |
| | | string prjguid=""; |
| | | int pitem = this.GetProjectItem(hItem); |
| | | if(pitem > 0) |
| | | prjguid = GetItemGuid(pitem); |
| | | |
| | | //xaserverarg arg = new xaserverarg; |
| | | //arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("project.guid",prjguid); |
| | | if(hP2Item) |
| | | { |
| | | if(hP2Item != hItem) |
| | | { |
| | | string guid = e.getAttribute("guid"); |
| | | arg.AddArg("guid",guid); |
| | | } |
| | | string guid2 = GetItemGuid(hP2Item); |
| | | arg.AddArg("root.guid",guid2); |
| | | }else if(hDomainItem > 0) |
| | | { |
| | | string guid3 = GetItemGuid(hDomainItem); |
| | | arg.AddArg("domain.guid",guid3); |
| | | } |
| | | return 1; |
| | | } |
| | | else if(node=="folder" || node=="project") |
| | | return 2; |
| | | else |
| | | return 0; |
| | | } |
| | | |
| | | int SaveData(int hItem) |
| | | { |
| | | xcontrol xc = GetControl("surl"); |
| | | string surl = xc.GetText(); |
| | | if(surl == "") |
| | | { |
| | | alert("请è¾å
¥åæ¥æå¡å¨å°å"); |
| | | return 1; |
| | | } |
| | | |
| | | string name = xtreeview::GetItemLabel(tv_gs.GetId(), hItem); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | int ret = GetDataArg(hItem, arg); |
| | | //alert(arg.GetString()); |
| | | if(ret == 0) |
| | | { |
| | | WriteLog(name+" 失败, åå :è·åå·¥ç¨ææä»¶å¤¹å¤±è´¥!"); |
| | | return -1; |
| | | } |
| | | else if(ret == 2) |
| | | { |
| | | ret = SynchFolder(hItem); |
| | | if(ret == -1) |
| | | WriteLog(name+" 失败, åå :è·åæä»¶æ°æ®å¤±è´¥!"); |
| | | else if(ret == 0) |
| | | WriteLog(name+" 失败, åå :å¤å¶æä»¶å¤±è´¥!"); |
| | | else |
| | | WriteLog(name); |
| | | return -1; |
| | | } |
| | | SynchFolder(hItem); |
| | | arg.AddArg("__name",name); |
| | | arg.AddArg("__url",surl); |
| | | synchServer(arg); |
| | | if(name.right(3) == ".vx" || name.right(5) == ".xpage") |
| | | { |
| | | arg.AddArg("__name",name + "[Code]"); |
| | | arg.AddArg("iscode","yes"); |
| | | synchServer(arg); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | string GetFolderPath(int hItem) |
| | | { |
| | | int k = hItem; |
| | | if(k == 0) return ""; |
| | | string src = ""; |
| | | //string name = ""; |
| | | while(k > 0) |
| | | { |
| | | int h = xtreeview::GetItemData(tv_gs.GetId(), k); |
| | | k = xtreeview::GetParentItem(tv_gs.GetId(), k); |
| | | msxml::IXMLDOMElement e = trust(h as msxml::IXMLDOMElement); |
| | | string node = GetEleString(e, "@tagname"); |
| | | if(node != "File" && node != "file") |
| | | { |
| | | string tmp = GetEleString(e, "@src"); |
| | | //if(name == "") name = GetEleString(e, "@caption"); |
| | | if(tmp != "") |
| | | { |
| | | SynchFolder(k); |
| | | if(src == "") src = tmp; |
| | | else |
| | | { |
| | | int j = 1; |
| | | int s = tmp.length(); |
| | | string t = tmp.right(j).left(1); |
| | | while(t != "\\" && j < s) |
| | | { |
| | | //WriteLog(t); |
| | | j++; |
| | | t = tmp.right(j).left(1); |
| | | } |
| | | if(j >= s) |
| | | src = tmp+ "\\" + src; |
| | | else |
| | | src = tmp.left(s - j)+ "\\" + src; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if(src == "") |
| | | { |
| | | //WriteLog(name+" åæ¥å¤±è´¥, åå :è·åæä»¶æ°æ®å¤±è´¥0!"); |
| | | return ""; |
| | | } |
| | | //if(src.left(9) =="Projects\\") src = src.mid(9, src.length()); |
| | | src = "\\" + src;//.replace("Projects\\",""); |
| | | //WriteLog(src); |
| | | return src; |
| | | } |
| | | |
| | | int SynchFolder(int hItem) |
| | | { |
| | | string src = GetFolderPath(hItem); |
| | | if(src== "") return -1; |
| | | if(xaserver::FileCopy("devfolder8001", src, "devfolder5001", src) != 1) |
| | | return 0; |
| | | //WriteLog(src); |
| | | return 1; |
| | | } |
| | | |
| | | int synchServer(xaserverarg arg) |
| | | { |
| | | string name = arg.GetArgString("__name"); |
| | | string surl = arg.GetArgString("__url"); |
| | | string d = ProcessDevCmd("getobject",arg.GetString()); |
| | | if(d == "") |
| | | { |
| | | WriteLog(name+" 失败, åå :è·åæä»¶æ°æ®å¤±è´¥!"); |
| | | return -1; |
| | | } |
| | | //WriteLog(d); |
| | | arg.AddArg("content",d); |
| | | ProcessDevCmd("saveobject",arg.GetString(), surl,true); |
| | | WriteLog(name); |
| | | return 1; |
| | | } |
| | | |
| | | int WriteLog(string str) |
| | | { |
| | | if(sContent == "") |
| | | sContent = str; |
| | | else |
| | | sContent += "\r\n" + str; |
| | | //alert(sContent); |
| | | dw_log.SetContent(sContent, ""); |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int Add(int hItem) |
| | | { |
| | | if(nCount >99) |
| | | { |
| | | alert("åæ¶åæ¥çæ°éä¸è½å¤§äº100个!"); |
| | | return 1; |
| | | } |
| | | nItems[nCount] = hItem; |
| | | nCount++; |
| | | return 1; |
| | | } |
| | | |
| | | int Del(int hItem) |
| | | { |
| | | for(int i=0; i<nCount; i++) |
| | | { |
| | | int p = nItems[i]; |
| | | if(p == hItem) break; |
| | | } |
| | | if(i<nCount) |
| | | { |
| | | for(int j=i; j<nCount - 1; j++) |
| | | { |
| | | int k = nItems[j + 1]; |
| | | nItems[j] = k; |
| | | } |
| | | nCount --; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid != "synch") return 1; |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | sContent = ""; |
| | | for(int i=0; i<nCount; i++) |
| | | { |
| | | int p = nItems[i]; |
| | | //int h = xtreeview::GetItemData(tv_gs.GetId(), p); |
| | | //msxml::IXMLDOMElement e = trust(h as msxml::IXMLDOMElement); |
| | | //alert(e.xml); |
| | | SaveData(p); |
| | | xtreeview::SetChecked(tv_gs.GetId(), p,0); |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | nCount = 0; |
| | | return 0; |
| | | } |
| | | |
| | | int OnTreeCheckBoxSel(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref TVNNMHDR nmtv = trust(evt.pnmh as ref TVNNMHDR); |
| | | int hItem = nmtv.FromItem; |
| | | int hCursor = xutil::SetCursorWait(); |
| | | int hwnd = nmtv.hwndFrom; |
| | | int c = 1 - xtreeview::GetChecked(hwnd, hItem); |
| | | if(c == 1) |
| | | Add(hItem); |
| | | else |
| | | Del(hItem); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | //AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("DevExplorer","TVN_CHECKBOXSEL",OnTreeCheckBoxSel); |
| | | AttachEvent("DevExplorer", "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int lparam) |
| | | { |
| | | ref NMTREEVIEW nmtv = trust(evt.pnmh as ref NMTREEVIEW); |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int cItem=xtreeview::GetChildItem(tv_gs.GetId(), hItem); |
| | | if(cItem > 0) return 1; |
| | | int p = xtreeview::GetItemData(tv_gs.GetId(), hItem); |
| | | msxml::IXMLDOMElement ele = trust(p as msxml::IXMLDOMElement); |
| | | string src =GetEleString(ele, "@src"); |
| | | string tagname =GetEleString(ele, "@tagname"); |
| | | if (src == "" || tagname == "file" || tagname == "File") return 1; |
| | | OnSetTree(hItem, GetFolderPath(hItem)); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetTree(int pItem, msxml::IXMLDOMElement e) |
| | | { |
| | | msxml::IXMLDOMNodeList li=e.selectNodes("*"); |
| | | int i=0; |
| | | int s=li.length; |
| | | for (i=0;i<s;i++){ |
| | | msxml::IXMLDOMElement ele= li.item(s - i - 1); |
| | | string caption = GetEleString(ele, "@caption"); |
| | | string src =GetEleString(ele, "@src"); |
| | | string image =GetEleString(ele, "@image"); |
| | | int p = trust(ele as int); |
| | | int hItem=xtreeview::InsertItem(tv_gs.GetId(), pItem,0,caption,p,image.toInt()); |
| | | string tagname =GetEleString(ele, "@tagname"); |
| | | if (src != "" && tagname != "file" && tagname != "File") |
| | | xtreeview::SetItemChild1(tv_gs.GetId(), hItem,1); |
| | | OnSetTree(hItem, ele); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetTree(int hItem, string src) |
| | | { |
| | | xml x=new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("src",src); |
| | | if(xaserver::ExecXQuery(GetServerUrl(),"[Developer.Tree.xq]",arg.GetString(),x)!=1) |
| | | { |
| | | alert("读åèç¹å¤±è´¥!"); |
| | | return 1; |
| | | } |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | OnSetTree(hItem, e); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | nCount = 0; |
| | | tv_gs = GetControl("DevExplorer"); |
| | | dw_log = GetControl("xlog"); |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | OnSetTree(0, "Projects/projects.xhw"); |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | use "xflowchart.wobject.wface.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class flow : public xframe |
| | | { |
| | | xtreeview tv_1; |
| | | xlayersheet tab_1; |
| | | xdwgrid dw_flow; |
| | | xdwgrid dw_state; |
| | | xdwgrid dw_button; |
| | | xdwgrid dw_role; |
| | | xdwgrid dw_bill; |
| | | xdwgrid dw_scene; |
| | | xdwgrid dw_buttonright; |
| | | xdwgrid dw_datafieldright; |
| | | string flowid; |
| | | |
| | | xtreeview tv_folder; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | string GetSheetType(int index) |
| | | { |
| | | if (index == 0) return "flowitem"; |
| | | else if (index == 1) return "state"; |
| | | else if (index == 2) return "actionrole"; |
| | | else if (index == 3) return "button"; |
| | | else if (index == 4) return "role"; |
| | | else if (index == 5) return "bill"; |
| | | else if (index == 6) return "scene"; |
| | | else if (index ==7) return "fieldrole"; |
| | | else return "unkown"; |
| | | } |
| | | xdwgrid GetSheetDwgrid(int index) |
| | | { |
| | | string typ = GetSheetType(index); |
| | | if(typ=="flowitem") return dw_flow; |
| | | if(typ=="actionrole") return dw_buttonright; |
| | | if(typ=="state") return dw_state; |
| | | if(typ=="button") return dw_button; |
| | | if(typ=="role") return dw_role; |
| | | if(typ=="bill") return dw_bill; |
| | | if(typ=="scene") return dw_scene; |
| | | if(typ=="fieldrole") return dw_datafieldright; |
| | | return 0; |
| | | } |
| | | xdwgrid GetSheetDbmap(int index) |
| | | { |
| | | string typ = GetSheetType(index); |
| | | if(typ=="flowitem") return "flow.dbmap"; |
| | | if(typ=="actionrole") return "workflow.actionrole.dbmap"; |
| | | if(typ=="state") return "state.dbmap"; |
| | | if(typ=="button") return "button.dbmap"; |
| | | if(typ=="role") return "role.dbmap"; |
| | | if(typ=="bill") return "bill.dbmap"; |
| | | if(typ=="scene") return "scene.dbmap"; |
| | | if(typ=="fieldrole") return "workflow.datarole.dbmap"; |
| | | return 0; |
| | | } |
| | | |
| | | string GetDwname(string typ) |
| | | { |
| | | if(typ=="flowitem") return "/sale/view/Flow3/template/flow"; |
| | | if(typ=="actionrole") return "/sale/view/Flow3/template/buttonright"; |
| | | if(typ=="state") return "/sale/view/Flow3/template/state"; |
| | | if(typ=="button") return "/sale/view/Flow3/template/button"; |
| | | if(typ=="role") return "/sale/view/Flow3/template/role"; |
| | | if(typ=="bill") return "/sale/view/Flow3/template/bill"; |
| | | if(typ=="scene") return "/sale/view/Flow3/template/scene"; |
| | | if(typ=="fieldrole") return "/sale/view/Flow3/template/datafieldright"; |
| | | return ""; |
| | | } |
| | | |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | if(flowid=="") return 1; |
| | | |
| | | string sdbmap; |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | int index = tab_1.GetSheetIndex(); |
| | | sdbmap = GetSheetDbmap(index); |
| | | xdwgrid dw_list = GetSheetDwgrid(index); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | //trace(x.GetXml()); |
| | | |
| | | msxml::IXMLDOMNodeList ls = x.GetXmlDoc().documentElement.SelectNodes("*[@update.modify='1' and @update.new='1']"); |
| | | int len = ls.length; |
| | | for(int k=0;k<len;k++) |
| | | { |
| | | msxml::IXMLDOMElement e; |
| | | if(ls.item(k).selectSingleNode("flowID")) |
| | | { |
| | | e = ls.item(k).selectSingleNode("flowID"); |
| | | e.setAttribute("update.modify","1"); |
| | | e.text = flowid; |
| | | }else |
| | | { |
| | | e = x.GetXmlDoc().createElement("flowID"); |
| | | e.setAttribute("update.modify","1"); |
| | | e.text = flowid; |
| | | ls.item(k).appendChild(e); |
| | | } |
| | | } |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("sdbmap",sdbmap); |
| | | trace(x.GetXml()); |
| | | if(url::get("/sale/data/Flow3/save/flow", arg.GetString(),x)!=1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert("err:"+error); |
| | | return 1; |
| | | } |
| | | |
| | | dw_list.ResetUpdateStatus(); |
| | | |
| | | //alert(x.GetXml()); |
| | | alert("ä¿åæåï¼"); |
| | | |
| | | return 1; |
| | | } |
| | | int OnAddrow() |
| | | { |
| | | int i = tab_1.GetSheetIndex(); |
| | | xdwgrid dw_list = GetSheetDwgrid(i); |
| | | dw_list.InsertRow(0); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertrow() |
| | | { |
| | | int i = tab_1.GetSheetIndex(); |
| | | xdwgrid dw_list = GetSheetDwgrid(i); |
| | | dw_list.InsertRow(dw_list.GetRow()); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleterow() |
| | | { |
| | | int i = tab_1.GetSheetIndex(); |
| | | xdwgrid dw_list = GetSheetDwgrid(i); |
| | | dw_list.DeleteRow(0); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | |
| | | //alert(evt.hWnd.toString()); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | string colname=hdr.colname; |
| | | |
| | | //trace(colname); |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | string comdid =""; |
| | | string data=""; |
| | | string display=""; |
| | | xdwgrid dw_list; |
| | | |
| | | int index = tab_1.GetSheetIndex(); |
| | | dw_list = GetSheetDwgrid(index); |
| | | |
| | | arg.AddArg("sdata",""); |
| | | arg.AddArg("flowid",flowid); |
| | | |
| | | if(colname=="billID") |
| | | { |
| | | arg.AddArg("stype","bill"); |
| | | arg.AddArg("datacolumn","billID"); |
| | | arg.AddArg("displaycolumn","billName"); |
| | | arg.AddArg("dwname","/sale/view/Flow3/template/bill"); |
| | | } |
| | | else if(colname=="stateSource") |
| | | { |
| | | arg.AddArg("stype","state"); |
| | | arg.AddArg("datacolumn","stateID"); |
| | | arg.AddArg("displaycolumn","stateName"); |
| | | arg.AddArg("dwname","/sale/view/Flow3/template/state"); |
| | | } |
| | | else if(colname=="state") |
| | | { |
| | | arg.AddArg("stype","state"); |
| | | arg.AddArg("datacolumn","stateID"); |
| | | arg.AddArg("displaycolumn","stateName"); |
| | | arg.AddArg("dwname","/sale/view/Flow3/template/state"); |
| | | } |
| | | else if(colname=="stateTarget") |
| | | { |
| | | arg.AddArg("stype","state"); |
| | | arg.AddArg("datacolumn","stateID"); |
| | | arg.AddArg("displaycolumn","stateName"); |
| | | arg.AddArg("dwname","/sale/view/Flow3/template/state"); |
| | | } |
| | | else if(colname=="roles") |
| | | { |
| | | arg.AddArg("stype","role"); |
| | | arg.AddArg("datacolumn","roleName"); |
| | | arg.AddArg("displaycolumn","roleName"); |
| | | arg.AddArg("dwname","/sale/view/Flow3/template/role"); |
| | | } |
| | | else if(colname=="flowAction") |
| | | { |
| | | arg.AddArg("stype","button"); |
| | | arg.AddArg("datacolumn","buttonName"); |
| | | arg.AddArg("displaycolumn","buttonName"); |
| | | arg.AddArg("dwname","/sale/view/Flow3/template/button"); |
| | | } |
| | | else |
| | | return 1; |
| | | |
| | | OpenWindow("dev:xpage[FlowTermSelect.vx]",cast(arg as int)); |
| | | comdid = arg.GetArgString("comdid"); |
| | | |
| | | if(comdid=="xmOk") |
| | | { |
| | | data = arg.GetArgString("data"); |
| | | display = arg.GetArgString("display"); |
| | | dw_list.SetItemDisplayString(row,colname,display); |
| | | dw_list.SetItemString(row,colname,data); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnImport() |
| | | { |
| | | int i = tab_1.GetSheetIndex(); |
| | | xdwgrid dw_list = GetSheetDwgrid(i); |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.SetArg("stype",GetSheetType(i),"string"); |
| | | arg.SetArg("sdata","ddd","string"); |
| | | arg.SetArg("flowID",flowid,"string"); |
| | | int obj = cast(dw_list as int); |
| | | arg.SetArg("dwobj",obj.toString(),"string"); |
| | | arg.SetArg("dwname",GetDwname(GetSheetType(i)),"string"); |
| | | OpenWindow("dev:xpage[FlowTermImport.vx]",cast(arg as int)); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | if(flowid=="") return 1; |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | //int i = tab_1.GetSheetIndex(); |
| | | for(int i=0;i<7;i++) |
| | | { |
| | | //alert(i.toString()); |
| | | arg.SetArg("stype",GetSheetType(i),"string"); |
| | | arg.SetArg("sdata","ddd","string"); |
| | | arg.SetArg("flowID",flowid,"string"); |
| | | |
| | | //trace(arg.GetString()); |
| | | if (getUrl("/sale/data/Flow3/retrieve/flowex",arg.GetString(),x)!=1) |
| | | { |
| | | //trace(x.GetXmlDoc().text); |
| | | //return -1; |
| | | continue; |
| | | } |
| | | xdwgrid dw_list = GetSheetDwgrid(i); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW); |
| | | int hItem = nmtv.itemNew.hItem; |
| | | msxml::IXMLDOMElement e = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement); |
| | | flowid = e.getAttribute("flowID"); |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | SetFlowChart(e); |
| | | OnRetrieve(); |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnTabSelectSheet(ref TNotifyEvent evt,int p) |
| | | { |
| | | //OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int SetFlowChart(msxml::IXMLDOMElement e) |
| | | { |
| | | string flowUrl = e.getAttribute("flowchart"); |
| | | xflowchart flowchart = GetControl("flowchart"); |
| | | xml f = new xml; |
| | | f.setNativePointer(xml::CreateInstance()); |
| | | if(flowUrl != "") |
| | | { |
| | | if(xaserver::FetchXml(flowUrl,"",f)==1) |
| | | { |
| | | flowchart.LoadEx(f.GetXmlDoc().documentElement); |
| | | } |
| | | }else |
| | | { |
| | | f.LoadXml("<sheet/>"); |
| | | flowchart.LoadEx(f.GetXmlDoc().documentElement); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmSave") |
| | | return OnSave(); |
| | | if (comdid == "xmAddrow") |
| | | return OnAddrow(); |
| | | if (comdid == "xmInsertrow") |
| | | return OnInsertrow(); |
| | | if (comdid == "xmDeleterow") |
| | | return OnDeleterow(); |
| | | if (comdid == "xmImport") |
| | | return OnImport(); |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | |
| | | AttachEvent("tv_folder", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("tab_1","LYSN_SELECTEDSHEET",OnTabSelectSheet); |
| | | AttachEvent("dw_flow","DWV_CLICKED",OnClicked); |
| | | AttachEvent("dw_buttonright","DWV_CLICKED",OnClicked); |
| | | AttachEvent("dw_button","DWV_CLICKED",OnClicked); |
| | | AttachEvent("dw_state","DWV_CLICKED",OnClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int CreateFlowFloder() |
| | | { |
| | | |
| | | xml x = ViewObject::RetrieveData("/sale/data/flow3/flowfolder"); |
| | | if(x) |
| | | { |
| | | msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//item"); |
| | | int len = nlist.length; |
| | | int hItem = 0; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.getAttribute("flowName"); |
| | | string no = e.getAttribute("flowNo"); |
| | | string label = name;//no.trim() + " " + name; |
| | | int h= tv_folder.InsertChildItem(hItem,label, trust(e as int),22); |
| | | //tv_folder.SetItemChild(h,1); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | flowid = ""; |
| | | tv_folder = GetControl("tv_folder"); |
| | | CreateFlowFloder(); |
| | | |
| | | tv_1 = GetControl("tv_1"); |
| | | tab_1 = GetControl("tab_1"); |
| | | dw_flow = GetControl("dw_flow"); |
| | | dw_flow.openUrl("/sale/view/Flow3/template/flow"); |
| | | dw_state = GetControl("dw_state"); |
| | | dw_state.openUrl("/sale/view/Flow3/template/state"); |
| | | dw_button = GetControl("dw_button"); |
| | | dw_button.openUrl("/sale/view/Flow3/template/button"); |
| | | dw_role = GetControl("dw_role"); |
| | | dw_role.openUrl("/sale/view/Flow3/template/role"); |
| | | dw_bill = GetControl("dw_bill"); |
| | | dw_bill.openUrl("/sale/view/Flow3/template/bill"); |
| | | dw_scene = GetControl("dw_scene"); |
| | | dw_scene.openUrl("/sale/view/Flow3/template/scene"); |
| | | dw_buttonright = GetControl("dw_buttonright"); |
| | | dw_buttonright.openUrl("/sale/view/Flow3/template/buttonright"); |
| | | dw_datafieldright = GetControl("dw_datafieldright"); |
| | | dw_datafieldright.openUrl("/sale/view/Flow3/template/datafieldright"); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class FlowTermImport : public xframe |
| | | { |
| | | xdwgrid dw_list; |
| | | string stype; |
| | | string sdata; |
| | | string flowid; |
| | | string datacolumn; |
| | | string displaycolumn; |
| | | xdwgrid dw_obj; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK(string comdid) |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if(row < 1 && dw_list.GetRowCount()==1) row = 1; |
| | | if (row<1) |
| | | { |
| | | alert("è¯·éæ©é¡¹!"); |
| | | return 1; |
| | | } |
| | | |
| | | while (row>0) |
| | | { |
| | | int nrow = dw_obj.InsertRow(0); |
| | | int columnCount = dw_obj.GetColumnCount(); |
| | | for(int i=1;i<=columnCount;i++) |
| | | { |
| | | if(dw_list.GetColumnName(i)=="guid") continue; |
| | | dw_obj.SetItemString(nrow,i,dw_list.GetItemString(row,i)); |
| | | if(dw_list.GetItemDisplayString(row,i)!="") |
| | | dw_obj.SetItemDisplayString(nrow,i,dw_list.GetItemDisplayString(row,i)); |
| | | } |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="xmOk") |
| | | { |
| | | OnOK(comdid); |
| | | return 1; |
| | | } |
| | | else if (comdid=="xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | arg.AddArg("stype",stype); |
| | | arg.AddArg("sdata",sdata); |
| | | arg.AddArg("flowID",flowid); |
| | | |
| | | if (getUrl("/sale/data/Flow3/retrieve/flowimport",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | dw_list = GetControl("dw_list"); |
| | | //dw_list.openUrl("xxx"); |
| | | if(GetParam()) |
| | | { |
| | | xaserverarg arg = GetParam(); |
| | | stype = arg.GetArgString("stype"); |
| | | sdata = arg.GetArgString("sdata"); |
| | | flowid = arg.GetArgString("flowid"); |
| | | |
| | | string dwname = arg.GetArgString("dwname"); |
| | | int dwobj = arg.GetArgString("dwobj").toInt(); |
| | | dw_obj = cast(dwobj as xdwgrid); |
| | | |
| | | dw_list.openUrl(dwname); |
| | | OnRetrieve(); |
| | | dw_list.SetSelectionMode(3); |
| | | } |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class FlowTermSelect : public xframe |
| | | { |
| | | xdwgrid dw_list; |
| | | string stype; |
| | | string sdata; |
| | | string flowid; |
| | | string datacolumn; |
| | | string displaycolumn; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK(string comdid) |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg = GetParam(); |
| | | arg.AddArg("comdid",comdid); |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if(row < 1 && dw_list.GetRowCount()==1) row = 1; |
| | | if (row<1) |
| | | { |
| | | alert("è¯·éæ©é¡¹!"); |
| | | return 1; |
| | | } |
| | | |
| | | while (row>0) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string data = e.selectSingleNode(datacolumn).text+""; |
| | | string display = e.selectSingleNode(displaycolumn).text+""; |
| | | arg.AddArg("data",data); |
| | | arg.AddArg("display",display); |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="xmOk") |
| | | { |
| | | OnOK(comdid); |
| | | return 1; |
| | | } |
| | | else if (comdid=="xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | |
| | | arg.AddArg("stype",stype); |
| | | arg.AddArg("sdata",sdata); |
| | | arg.AddArg("flowID",flowid); |
| | | |
| | | if (getUrl("/sale/data/Flow3/retrieve/flowex",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | dw_list = GetControl("dw_list"); |
| | | //dw_list.openUrl("xxx"); |
| | | if(GetParam()) |
| | | { |
| | | xaserverarg arg = GetParam(); |
| | | stype = arg.GetArgString("stype"); |
| | | sdata = arg.GetArgString("sdata"); |
| | | flowid = arg.GetArgString("flowid"); |
| | | |
| | | datacolumn = arg.GetArgString("datacolumn"); |
| | | displaycolumn = arg.GetArgString("displaycolumn"); |
| | | |
| | | string dwname = arg.GetArgString("dwname"); |
| | | dw_list.openUrl(dwname); |
| | | OnRetrieve(); |
| | | dw_list.SetSelectionMode(1); |
| | | } |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #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: |
| | | ProductLibrary4Win(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static ProductLibrary4Win* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | ProductLibrary4Win* pWin = new ProductLibrary4Win(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | 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 KXMLDOMElement(); |
| | | KXMLDOMElement e = dw_list.GetRowElement(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 = dw_list.GetGuid(row); |
| | | 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 = dw_list.GetItemString(row, L"SKUID"); |
| | | xstring customerItemNo =dw_list.GetItemString( 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 = dw_list.GetGuid(row); |
| | | |
| | | 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 = dw_list.GetItemString(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'>" + dw_list.GetItemString( row, (LPCTSTR)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 (dw_list.GetItemString( row, (LPCTSTR)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>" + dw_list.GetItemString( row, (LPCTSTR)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 (dw_list.GetItemString( 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' >" + dw_list.GetItemString( 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 >" +dw_list.GetItemString( row, (LPCTSTR)name) + L"</td>"; |
| | | html += L"</tr>"; |
| | | } |
| | | |
| | | html += L"<tr>"; |
| | | html += L"<td rowspan='3'>" +dw_list.GetItemString( row, L"PackCode") + L"</td><td >å
è£
æ¹å¼</td><td >" + |
| | | dw_list.GetItemString(row, L"CPack") + L"</td>"; |
| | | html += L"</tr>"; |
| | | html += L"<tr height='48'>"; |
| | | html += L"<td >å
è£
è¦æ±</td><td >" +dw_list.GetItemString( 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>" +dw_list.GetItemString( row, L"QualityCode") + L"</td><td >è´¨éè¦æ±</td><td >" + |
| | | dw_list.GetItemString(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", 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 = dw_list.GetRowElement(row); |
| | | xstring skuid = dw_list.GetItemString( row, L"@guid"); |
| | | xstring SKUNo = dw_list.GetItemString( 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 ; |
| | | x.loadXML(L"<Item update.new='1' update.modify='1' guid='" + id + L"'>" + |
| | | L"<ProductPictureID>" + id + L"</ProductPictureID>" + |
| | | L"<OriginFile>" + originfile + L"</OriginFile>" + |
| | | L"<FileExt>" + ext + L"</FileExt>" + |
| | | L"<SKUID>" + skuid + L"</SKUID>" + |
| | | L"<Name>[" + SKUNo.trim() + L"]</Name>" + |
| | | L"<FileName>" + id + L".jpg</FileName>" + |
| | | L"</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xurl::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 = dw_list.GetRowElement( row); |
| | | xstring skuid =dw_list.GetItemString( row, L"SKUID"); |
| | | xstring SKUNo =dw_list.GetItemString( row, L"SKUID/@__displaystring"); |
| | | xstring CustomerID = m_customer; |
| | | xstring CustomerItemNo =dw_list.GetItemString( 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; |
| | | x.loadXML(L"<Item update.new='1' update.modify='1' guid='" + id + L"'>" + |
| | | L"<ProductPictureID>" + id + L"</ProductPictureID>" + |
| | | L"<OriginFile>" + originfile + L"</OriginFile>" + |
| | | L"<FileExt>" + ext + L"</FileExt>" + |
| | | L"<SKUID>" + skuid + L"</SKUID>" + |
| | | L"<CustomerItemNo>" + CustomerItemNo + L"</CustomerItemNo>" + |
| | | L"<CustomerID>" + CustomerID + L"</CustomerID>" + |
| | | L"<Name>[" + SKUNo.trim() + L"]</Name>" + |
| | | L"<FileName>" + id + L".jpg</FileName>" + |
| | | L"</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"content", x.xml()); |
| | | if (xurl::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 (MessageBox(GetHWND(), L"确认å é¤å½åå¾ç?", L"æç¤º", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | xstring id = images.item(index).selectSingleNode(L"@guid").text(); |
| | | |
| | | xml x ; |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; |
| | | arg.AddArg(L"content", str); |
| | | if (xurl::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 =dw_list.GetItemString( row, L"SKUID"); |
| | | xstring SKUNo =dw_list.GetItemString( row, L"SKUID/@__displaystring"); |
| | | xstring CustomerID = m_customer; |
| | | xstring CustomerItemNo =dw_list.GetItemString( 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 (MessageBox(GetHWND(), L"确认å é¤å½åå¾ç?", L"æç¤º", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | xstring id = images.item(index).selectSingleNode(L"@guid").text(); |
| | | |
| | | xml x; |
| | | xaserverarg arg; |
| | | xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; |
| | | arg.AddArg(L"content", str); |
| | | if (xurl::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 = dw_list.GetRowElement(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 = dw_list.GetRowElement(row); |
| | | //KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | //alert(e.xml); |
| | | xstring id = dw_list.GetItemString( row, L"@guid"); |
| | | //alert(id); |
| | | |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | xstring categoryid = e1.selectSingleNode(L"@guid").text(); |
| | | //alert(categoryid); |
| | | xaserverarg* arg = new xaserverarg; |
| | | arg->AddArg(L"SKUID", id); |
| | | arg->AddArg(L"CategoryID", categoryid); |
| | | |
| | | OpenWindow(L"dev:xpage[PictureView.Product3.vx]", (LPARAM)arg); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ItemMaint() |
| | | { |
| | | HTREEITEM 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); |
| | | #ifdef shouldfinished |
| | | int pr = g_xdoc_product; |
| | | OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", pr); |
| | | #endif |
| | | return 1; |
| | | } |
| | | |
| | | int ItemAdd() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM 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; |
| | | 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); |
| | | OpenWindow(L"dev:xpage[Quick.Input.NewProduct.vx]", (LPARAM)&arg); |
| | | |
| | | if (arg.GetArgString(L"data.modify") == L"1")RetrieveData(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddFolder() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | |
| | | xaserverarg arg; |
| | | 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]",(LPARAM)&arg); |
| | | /*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() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM hTopItem = LookupTopFolder(hItem); |
| | | xstring name = tv_folder.GetItemLabel(hTopItem); |
| | | xstring selectname = tv_folder.GetItemLabel(hItem); |
| | | |
| | | xaserverarg arg; |
| | | 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]", (LPARAM)&arg); |
| | | 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") |
| | | { |
| | | #ifdef shouldfinish |
| | | OpenWindow(L"dev:xpage[ShoppingCartProductMaint.vx]", trust(g_xdoc_shoppingcart as int)); |
| | | #endif |
| | | 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.setNativePointer(carg.CreateInstance()); |
| | | 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.setNativePointer(carg.CreateInstance()); |
| | | 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"xmSearch") |
| | | { |
| | | RetrieveData(); |
| | | 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; |
| | | xstring skuid = dw_list.GetItemString( 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 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") |
| | | { |
| | | #ifdef shouldfinish |
| | | int r = cast(g_xdoc_product.getData(L"data/Item", L"@guid") as int); |
| | | OpenWindow(L"dev:xpage[Product.ItemProp.Maint.vx]", r); |
| | | #endif |
| | | 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 = 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 =dw_list.GetRowElement(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(TEvent* evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | //æ¥æ¾å½åæ 项ç顶级ç®å½ |
| | | 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 = 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, 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 MakeUserGoodsFolderItem(HTREEITEM 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; |
| | | |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, label, 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 = nlist.item(i); |
| | | xstring name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, 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 = nlist.item(i); |
| | | xstring name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, 35); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandItem(HTREEITEM 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""; |
| | | 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) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | return ExpandItem(hItem); |
| | | } |
| | | |
| | | int ResetAgent(xstring agentAsk) |
| | | { |
| | | if (agentFor != agentAsk) |
| | | { |
| | | agentFor = agentAsk; |
| | | m_agentNode = 0; |
| | | SetAgent(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | HTREEITEM LookupCustomerFolder(HTREEITEM hItem) |
| | | { |
| | | while (true) |
| | | { |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | 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(HTREEITEM hItem) |
| | | { |
| | | hItem = LookupCustomerFolder(hItem); |
| | | if (hItem == 0) return L""; |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | xstring str = e1.getAttribute(L"no"); |
| | | return str.mid(xstring(L"Customer:").length(), 9999); |
| | | } |
| | | |
| | | int RetrieveData() |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | HTREEITEM 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.Reset(); |
| | | im.Redraw(); |
| | | |
| | | |
| | | xshtml 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; |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | if (name == L"è´ç©è½¦") |
| | | { |
| | | if (selectname != name) |
| | | { |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | 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); |
| | | dw_list.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); |
| | | } |
| | | else if (e1.getAttribute(L"categoryid") != L"") |
| | | { |
| | | xstring categoryid = e1.getAttribute(L"categoryid"); |
| | | dwc_list.SetDataObject(ProductLibraryView::GetMaintListForm3(categoryid)); |
| | | dwc_list.SetReadOnly(true); |
| | | dwc_list.Reset(); |
| | | dw_list.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(); |
| | | dw_list.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); |
| | | } |
| | | //dwc_list.PostRetrieve(); |
| | | dwc_list.Redraw(); |
| | | |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | if (dwc_list.GetRowCount() >= 1) |
| | | { |
| | | xs.SetContent(makeGoodscarHtml(1)); |
| | | |
| | | if (m_customer != L"") |
| | | { |
| | | xstring skuid =dw_list.GetItemString( 1, L"SKUID"); |
| | | xstring customerItemNo =dw_list.GetItemString( 1, L"CustomerItemNo"); |
| | | OnShowImage(skuid, customerItemNo); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | im.Reset(); |
| | | 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"); |
| | | } |
| | | else |
| | | return 1; |
| | | |
| | | /* dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(no).GetXmlDoc()); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.Reset(); |
| | | dw_list.SetReadOnly(true); |
| | | */ |
| | | |
| | | if (name == L"个人åº") |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintRoleList3(no)); |
| | | else |
| | | { |
| | | if (queryString != L"") |
| | | { |
| | | |
| | | if (no == L"N000005") |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintList3(L"", queryString, L"")); |
| | | else |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintList3(no, queryString, L"")); |
| | | } |
| | | else |
| | | { |
| | | if (no == L"N000005") return 1; |
| | | dw_list.Retrieve(ProductLibraryView::GetMaintList3(no)); |
| | | } |
| | | } |
| | | //dw_list.PostRetrieve(); |
| | | dw_list.Redraw(); |
| | | |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | if (dw_list.GetRowCount() > 0) |
| | | { |
| | | xs.SetContent(makeHtml(1)); |
| | | xstring id = dw_list.GetItemString( 1, L"@guid"); |
| | | OnShowImage(id); |
| | | } |
| | | else |
| | | { |
| | | im.Reset(); |
| | | im.Redraw(); |
| | | |
| | | 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) |
| | | { |
| | | NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; |
| | | HTREEITEM hItem = nmtv.itemNew.hItem; |
| | | HTREEITEM 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(); |
| | | PostMessage(GetHWND(), 0x401, (WPARAM)L"xmRefresh", 0); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | 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, 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 OnViewZoomChange(TEvent* evt, int lParam) |
| | | { |
| | | ximageview im = GetControl(L"im1"); |
| | | xcombobox xc = GetControl(L"precent"); |
| | | xstring text = xc.GetLBText(); |
| | | int p = text.toInt(); |
| | | if (p == 0) p = 100; |
| | | im.Preview(p); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&ProductLibrary4Win::OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent(L"WM_SETFOCUS", (FEvent)&ProductLibrary4Win::OnSetFocus); |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductLibrary4Win::OnRowChanged); |
| | | AttachEvent(L"dwc_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductLibrary4Win::OnGoodsCarRowChanged); |
| | | AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING", (FEvent)&ProductLibrary4Win::OnTreeExpanding); |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&ProductLibrary4Win::OnTreeSelChanged); |
| | | AttachEvent(L"WM_COMMAND", (FEvent)&ProductLibrary4Win::OnCkbCLick); //checkboxæé©äºä»¶ |
| | | AttachEvent(L"WM_COMMAND", (FEvent)&ProductLibrary4Win::OnCkbCLick2); //checkboxæé©äºä»¶ |
| | | |
| | | AttachEvent(L"im1", L"IMG_LDBCLICK", (FEvent)&ProductLibrary4Win::OnImgDBClicked); |
| | | AttachEvent(L"precent", L"CBN_SELCHANGE", (FEvent)&ProductLibrary4Win::OnViewZoomChange); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | agentFor = L"goodslib"; |
| | | m_customer = 0; |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dwc_list = GetControl(L"dwc_list"); |
| | | |
| | | InitialFolder(); |
| | | |
| | | dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"")); |
| | | dw_list = GetControl(L"dw_list"); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodslist"); |
| | | dwc_list.SetReadOnly(true); |
| | | |
| | | tv_folder.ExpandItem(tv_folder.GetRootItem()); |
| | | tv_folder.ItemFocus(tv_folder.GetRootItem()); |
| | | |
| | | if (dw_list.GetRowCount()) |
| | | { |
| | | xshtml xs = GetControl(L"html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnImgDBClicked(TEvent * evt, int pr) |
| | | { |
| | | IMGNNMHDR& nmtv = *(IMGNNMHDR*)evt->notify.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.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; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class ViewLogList : public xwin |
| | | { |
| | | xdwgrid dw_list; |
| | | xoffice dw_office; |
| | | xcell dw_cell; |
| | | xnode m_agentNode; //Agent Condition |
| | | string m_category; |
| | | string argStr; |
| | | string searchStr; |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = 0; |
| | | if(comdid=="xmQuery") |
| | | { |
| | | xaserverarg ar = new xaserverarg; |
| | | ar.setNativePointer(ar.CreateInstance()); |
| | | ar.AddArg("argurl","/sale/view/Total3/arg/LogListItem"); |
| | | if(argStr !="") |
| | | ar.AddArg("arg",argStr); |
| | | OpenWindow("dev:xpage[view.total.arg.vx]",cast(ar as int)); |
| | | string arstr = ar.GetArgString("arg"); |
| | | if(arstr != "" && ar.GetArgString("action")=="ok") |
| | | { |
| | | argStr = arstr; |
| | | hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve("/sale/data/Total3/total/GDNTotal/Item/LogList",argStr); |
| | | |
| | | xutil::RestoreCursor(hCursor); |
| | | } |
| | | |
| | | else |
| | | { |
| | | argStr=""; |
| | | OnRetrieve("/sale/data/Total3/total/GDNTotal/Item/LogList",argStr); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | if(comdid=="xmAnalysis") |
| | | { |
| | | hCursor = xutil::SetCursorWait(); |
| | | string str = dw_list.DataAnalysis(""); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("html", str); |
| | | int obj = cast(dw_list as int); |
| | | arg.AddArg("obj",obj.toString()); |
| | | OpenWindow("dev:xpage[data.vanalysis.vx]", cast(arg as int)); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | if(comdid=="xmSearch") return OnSearch(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnSearch() |
| | | { |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("text", searchStr); |
| | | OpenWindow("dev:xpage[search.dialog.vx]", cast(arg as int)); |
| | | string str = arg.GetArgString("text"); |
| | | if(str != searchStr) |
| | | { |
| | | searchStr = str; |
| | | dw_list.Filter("*",searchStr); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | |
| | | int OnCombboChanged(ref TCommandEvent evt,int lParam) |
| | | { |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if(h > -1) |
| | | { |
| | | int hCursor = xutil::SetCursorWait(); |
| | | msxml::IXMLDOMElement e = xcombobox::GetItemData(evt.hCtrl, h); |
| | | |
| | | win32::PostMessage(GetHWND(),0x401,"xmQuery",0); |
| | | //OnCmdDispatch("xmQuery"); |
| | | xutil::RestoreCursor(hCursor); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnDWClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string value = hdr.data; |
| | | string colname = hdr.colname; |
| | | int row = hdr.row; |
| | | |
| | | if(row < 1) return 1; |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("cb_report","CBN_SELCHANGE",OnCombboChanged); |
| | | AttachEvent("dw_report","DWV_CLICKED",OnDWClick); |
| | | } |
| | | |
| | | int OnRetrieve(string dataurl, string argstr) |
| | | { |
| | | dw_list.Reset(); |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("arg",argstr); |
| | | //alert(argstr); |
| | | |
| | | if (url::get(dataurl,arg.GetString(),x)!=1) |
| | | { |
| | | //alert(x.GetXml()); |
| | | trace(x.GetXmlDoc().text); |
| | | dw_list.Redraw(); |
| | | return -1; |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_report"); |
| | | dw_office = GetControl("dw_office"); |
| | | dw_cell = GetControl("dw_cell"); |
| | | dw_list.openUrl("/sale/view/Total3/template/business/gdn/LogList/ship/full"); |
| | | |
| | | argStr =""; |
| | | xcombobox xc = GetControl("cb_report"); |
| | | |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | OnCmdDispatch("xmQuery"); |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | class __declspec(dllexport) SO3list : public listwin |
| | | { |
| | | public: |
| | | string m_sType; //æ éä¸çç±»å |
| | | string m_sTypeTxt; //æ éä¸çæ°æ® |
| | | string urlTree; |
| | | string myDataUrl; |
| | | string rows; |
| | | xcombobox ddlb_1; |
| | | xcombobox cbx_datashow; |
| | | |
| | | int changeddlb; |
| | | |
| | | xtreeview tv_folder; |
| | | xdwgrid dw_goods; |
| | | xdwgrid dw_source; |
| | | public: |
| | | SO3list(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static SO3list* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SO3list* pWin = new SO3list(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | //process tree |
| | | //æ¥æ¾å½åæ 项ç顶级ç®å½ |
| | | HTREEITEM LookupTopFolder(HTREEITEM hItem) |
| | | { |
| | | HTREEITEM hRoot = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); |
| | | return hItem; |
| | | } |
| | | |
| | | 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 = nlist.item(i); |
| | | string name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandFolderItem(HTREEITEM hItem, string no) |
| | | { |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),urlTree, L"no", no, L"rows", rows); |
| | | 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); |
| | | string name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, 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); |
| | | string name = tv_folder.GetItemLabel(hTopItem); |
| | | HTREEITEM child = tv_folder.GetChildItem(hItem); |
| | | |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | if (!child)ExpandFolderItem(hItem, e.getAttribute(L"no")); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å±å¼åæä»¶ |
| | | 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 = nlist.item(i); |
| | | string name = e.getAttribute(L"name"); |
| | | xstring sImage = e.getAttribute(L"image"); |
| | | xstring child = e.getAttribute(L"child"); |
| | | int image = 15; |
| | | if (sImage) image = sImage.toInt(); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); |
| | | if (child != L"no") 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"); |
| | | if (e) |
| | | ExpandChildFolder(0, e); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | if (changeddlb) return 1; |
| | | return OnPreRetrieve(); |
| | | } |
| | | |
| | | int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | dw_list.DeleteRow(DelRow); |
| | | return 1; |
| | | } |
| | | else if (updateItem == L"setstate") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | string id = GetEntityIDName(1); |
| | | string entity = ele.selectSingleNode(id).text(); |
| | | //trace(entity); |
| | | SetAgent(L"list", entity); |
| | | if (arg.GetArgString(L"state") != L"") |
| | | //this.dw_list.SetItemString(row, "ApprovalStatus", arg.GetArgString(L"state")); |
| | | dw_list.SetItemString(row, L"ApplyStatus", arg.GetArgString(L"state")); |
| | | if (arg.GetArgString(L"billstatus") != L"") |
| | | { |
| | | xstring billstatus = arg.GetArgString(L"billstatus"); |
| | | xstring statusName = GetBillStatusName(billstatus); |
| | | dw_list.SetItemString(row, L"ApprovalStatus", billstatus); |
| | | dw_list.SetItemDisplayString(row, L"ApprovalStatus", statusName); |
| | | } |
| | | |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | bool IsEmptyQueryStr(string queryStr) |
| | | { |
| | | if (queryStr == L"") return true; |
| | | if (queryStr == L"<items join='and'/>") return true; |
| | | if (queryStr == L"<items join=\"and\"/>") return true; |
| | | //trace(queryStr); |
| | | return false; |
| | | } |
| | | |
| | | //æ£ç´¢ |
| | | int OnPreRetrieve() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | if (!hItem) return 1; |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | string no = e1.getAttribute(L"no"); |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),myDataUrl, L"no", no, L"QueryTxt", m_QueryTxt, L"rows", rows); |
| | | if (x) |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | dw_list.Reset(); |
| | | dw_list.Redraw(); |
| | | dw_goods.Reset(); |
| | | dw_goods.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | /* |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"pageindex", m_pageIndex.toString(),""); //第å 页 |
| | | arg.AddArg(L"pagenumber", m_pageNumber.toString(),""); //æ¯é¡µæ°é |
| | | arg.AddArg(L"QueryTxt", m_QueryTxt,""); //æ¥è¯¢æ¡ä»¶ |
| | | arg.AddArg(L"sType",m_sType,""); |
| | | arg.AddArg(L"sTypeTxt",m_sTypeTxt,""); |
| | | xml x = ViewObject::MakeXml(); |
| | | |
| | | KXMLDOMElement n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]"); |
| | | if(n) |
| | | { |
| | | KXMLDOMElement e = n; |
| | | if(e.selectSingleNode(L"@dataUrl")) |
| | | { |
| | | string dataUrl = e.selectSingleNode(L"@dataUrl").text; |
| | | if(dataUrl.left(1)!="/") dataUrl = GetEntityName(1)+"/"+dataUrl; |
| | | getUrl(dataUrl, arg.GetString(), x); |
| | | KXMLDOMElement ele=x.GetXmlDoc().documentElement; |
| | | if(dw_pages.ptr_native_) |
| | | { |
| | | if(ele.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | string s=ele.selectSingleNode(L"@TotalPage").text; //æ»æ°é |
| | | dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | } |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | else |
| | | { |
| | | SetEntityData(arg); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | SetEntityData(arg); |
| | | } |
| | | */ |
| | | } |
| | | |
| | | //å岿°æ® |
| | | int Onhistroydata() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row > 0) |
| | | { |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xaserverarg& arg = * new xaserverarg; |
| | | string sCustomerID = e.selectSingleNode(L"CustomerID").text(); |
| | | arg.AddArg(L"CustomerID", sCustomerID, L""); |
| | | string sCustomerName = e.selectSingleNode(L"CustomerName").text(); |
| | | arg.AddArg(L"CustomerName", sCustomerName, L""); |
| | | arg.AddArg(L"EntityName", GetEntityName(1), L""); |
| | | arg.AddArg(L"EntityID", GetEntityID(1), L""); |
| | | openUrl(L"/sale/view/SO/xpage/histroydata", &arg); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox䏿 |
| | | int OnSelectDdlb(TEvent* evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | HWND wid = ddlb_1.GetHWND(); |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex =SendMessage(wid, CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]"); |
| | | string no = e2.selectSingleNode(L"@element").text(); |
| | | |
| | | HTREEITEM hItem = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetChildItem(hItem)) |
| | | tv_folder.DeleteItem(tv_folder.GetChildItem(hItem)); |
| | | ExpandFolderItem(hItem, no); |
| | | |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnSelectDataShowDdlb(TEvent* evt, LPARAM p) |
| | | { |
| | | HWND wid = cbx_datashow.GetHWND(); |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessage(wid, CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = cbx_datashow.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]"); |
| | | rows = e2.selectSingleNode(L"@rows").text(); |
| | | OnPreRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"action:bill.new") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | xstring no = publiccode::GetUser().no; |
| | | if (no != L"00303" && no != L"admin") |
| | | { |
| | | KXMLDOMDocument supplier_x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | if ((xstring)supplier_x.text() != L"ä¸å¡å") |
| | | { |
| | | alert(L"å½åè§è²ä¸æ¯ä¸å¡åä¸è½æ°å¢ååï¼è¯·éæ°éæ©è§è²"); |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (comdid == L"action:bill.annex") |
| | | { |
| | | xstring deptname = publiccode::GetUser().deptname; |
| | | if (deptname == L"éè´é¨") |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | xstring guid = dw_list.GetItemString(row, L"SOID"); |
| | | xaserverarg& arg = * new xaserverarg(); |
| | | |
| | | if (guid.length() <= 0)return 1; |
| | | |
| | | arg.AddArg(L"entityid", guid); |
| | | arg.AddArg(L"Type", L"Y"); |
| | | OpenWindow(L"dev:xpage[maint.Document.SO3.v3.vx]", arg); |
| | | |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:bill.histroydata") return Onhistroydata(); |
| | | else if (comdid == L"action:bill.refresh") |
| | | { |
| | | changeddlb = 1; |
| | | HTREEITEM RItem = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetChildItem(RItem)) |
| | | tv_folder.DeleteItem(tv_folder.GetChildItem(RItem)); |
| | | ExpandFolderItem(RItem, L"Category:Customer"); |
| | | tv_folder.ExpandItem(RItem); |
| | | tv_folder.ItemFocus(RItem); |
| | | changeddlb = 0; |
| | | return OnPreRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.saveas") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.SourceRemark") return OnSourceRemark(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSourceRemark() |
| | | { |
| | | xstring name = L"å¤éåå"; |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); |
| | | KXMLDOMNodeList items = x.selectNodes(L"data/Item"); |
| | | KXMLDOMNode t = items.item(0); |
| | | xstring Content = L""; |
| | | if (t.selectSingleNode(L"Content")) |
| | | { |
| | | Content = t.selectSingleNode(L"Content").text(); |
| | | } |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.AddArg(L"value", Content); |
| | | OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | |
| | | if (row < 1) return 1; |
| | | |
| | | //fixed one event only one process |
| | | listwin::OnRowChanged(evt, p); |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | xstring SONo = dw_list.GetItemString(row, L"SONo"); |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/maint/item", L"id", SONo); |
| | | if (x) |
| | | dw_goods.Retrieve(x); |
| | | else |
| | | dw_goods.Reset(); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | |
| | | x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/maint/itemwithsource", L"id", SONo); |
| | | if (x) |
| | | dw_source.Retrieve(x); |
| | | else |
| | | dw_source.Reset(); |
| | | dw_source.Redraw(); |
| | | dw_source.SetReadOnly(true); |
| | | |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int AttachListon() |
| | | { |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&SO3list::OnTreeSelChanged); //æ éæ© |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&SO3list::OnRowChanged);//ç»å®è¡æ´æ¹è§¦åäºä»¶OnRowChanged |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listwin::OnDoubleClicked); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&SO3list::OnSelectDdlb);//ç»å®ä¸ææ¡æ´æ¹è§¦åäºä»¶OnSelectDdlb |
| | | AttachEvent(L"cbx_datashow", L"CBN_SELCHANGE", (FEvent)&SO3list::OnSelectDataShowDdlb);//ç»å®éæ©æ°æ®æ¾ç¤ºä¸æå表äºä»¶OnSelectDataShowDdlb |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | changeddlb = 0; |
| | | listwin::onload(); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | cbx_datashow = GetControl(L"cbx_datashow"); |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(),L"/sale/view/SaleOrder/template/item"); |
| | | dw_source = GetControl(L"dw_source"); |
| | | dw_source.openUrl(GetServerUrl(), L"/sale/view/SaleOrder/template/sourceitem"); |
| | | |
| | | dw_goods.SetColumnState(L"ItemID", false); |
| | | dw_goods.SetColumnState(L"LineType", false); |
| | | dw_goods.SetColumnState(L"Brand", false); |
| | | dw_goods.SetColumnState(L"Assortment", false); |
| | | dw_goods.SetColumnState(L"ClassifyID", false); |
| | | dw_goods.SetColumnState(L"UnitFreight", false); |
| | | //dw_goods.SetColumnState(L"CName",false);//éèå |
| | | |
| | | dw_goods.SetColumnState(L"Brand", false); |
| | | dw_goods.SetColumnState(L"SKUNo", false); |
| | | dw_goods.SetColumnState(L"SOLineNo", false); |
| | | dw_goods.SetColumnState(L"CustomerPONo", false); |
| | | dw_goods.SetColumnState(L"ScheduleShipDate", false); |
| | | |
| | | dw_goods.SetColumnState(L"PackTechNote", false); |
| | | dw_goods.SetColumnState(L"EnquiryPriceListID", false); |
| | | dw_goods.SetColumnState(L"Submitter", false); |
| | | dw_goods.SetColumnState(L"POSupplierID", false); |
| | | dw_goods.SetColumnState(L"QuoteLineID", false); |
| | | |
| | | dw_list.SetColumnState(L"CreatorID", false); |
| | | dw_list.SetColumnState(L"SOID", false); |
| | | |
| | | |
| | | string groupname = publiccode::GetUser().groupname; |
| | | if (groupname == L"éè´å°ç»") |
| | | { |
| | | dw_list.SetColumnState(L"USDAmount", false); |
| | | dw_list.SetColumnState(L"RMBAmount", false); |
| | | |
| | | dw_goods.SetColumnState(L"UnitPrice", false); |
| | | dw_goods.SetColumnState(L"Amount", false); |
| | | dw_goods.SetColumnState(L"UnitCommPrice", false); |
| | | dw_goods.SetColumnState(L"CommissionRate", false); |
| | | |
| | | dw_source.SetColumnState(L"UnitPrice", false); |
| | | dw_source.SetColumnState(L"Amount", false); |
| | | dw_source.SetColumnState(L"FOBAmount", false); |
| | | dw_source.SetColumnState(L"BuyUnitPrice", false); |
| | | dw_source.SetColumnState(L"BuyAmount", false); |
| | | dw_source.SetColumnState(L"CostRate", false); |
| | | } |
| | | |
| | | rows = L"500"; |
| | | myDataUrl = L"/sale/data/SaleOrder/folder/list"; |
| | | urlTree = L"/sale/data/SaleOrder/folder"; |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | tv_folder.SetLineAtRoot(true); |
| | | InitialFolder(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | listwin::onloaded(); |
| | | |
| | | //attach my control event |
| | | AttachListon(); |
| | | |
| | | dw_list.SetColumnState(L"SOID", false); |
| | | |
| | | HTREEITEM hItem = tv_folder.GetRootItem(); |
| | | ExpandFolderItem(hItem, L"Category:Customer"); |
| | | tv_folder.ExpandItem(hItem); |
| | | //tv_folder.ItemFocus(tv_folder.GetChildItem(hItem)); |
| | | tv_folder.ItemFocus(hItem); |
| | | |
| | | |
| | | return -1; |
| | | } |
| | | |
| | | int ProcessUsedArg(xaserverarg arg) |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetCaretItem(); |
| | | if (hItem ) return 1; |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | xstring no = e.getAttribute(L"no"); |
| | | if (no.find(L"Customer:") >= 0) |
| | | { |
| | | arg.AddArg(L"CustomerID", e.getAttribute(L"id")); |
| | | xstring name = e.getAttribute(L"name"); |
| | | if (name.find(L"(L") >= 0) name = name.left(name.find(L"(L")); |
| | | arg.AddArg(L"CustomerName", name); |
| | | } |
| | | return 1; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | class __declspec(dllexport) SO3list : public listwin |
| | | { |
| | | public: |
| | | string m_sType; //æ éä¸çç±»å |
| | | string m_sTypeTxt; //æ éä¸çæ°æ® |
| | | string urlTree; |
| | | string myDataUrl; |
| | | string rows; |
| | | xcombobox ddlb_1; |
| | | xcombobox cbx_datashow; |
| | | |
| | | int changeddlb; |
| | | |
| | | xtreeview tv_folder; |
| | | xdwgrid dw_goods; |
| | | xdwgrid dw_source; |
| | | public: |
| | | SO3list(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static SO3list* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | SO3list* pWin = new SO3list(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | |
| | | //process tree |
| | | //æ¥æ¾å½åæ 项ç顶级ç®å½ |
| | | HTREEITEM LookupTopFolder(HTREEITEM hItem) |
| | | { |
| | | HTREEITEM hRoot = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); |
| | | return hItem; |
| | | } |
| | | |
| | | 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 = nlist.item(i); |
| | | string name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ExpandFolderItem(HTREEITEM hItem, string no) |
| | | { |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),urlTree, L"no", no, L"rows", rows); |
| | | 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); |
| | | string name = e.getAttribute(L"name"); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, 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); |
| | | string name = tv_folder.GetItemLabel(hTopItem); |
| | | HTREEITEM child = tv_folder.GetChildItem(hItem); |
| | | |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | if (!child)ExpandFolderItem(hItem, e.getAttribute(L"no")); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //å±å¼åæä»¶ |
| | | 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 = nlist.item(i); |
| | | string name = e.getAttribute(L"name"); |
| | | xstring sImage = e.getAttribute(L"image"); |
| | | xstring child = e.getAttribute(L"child"); |
| | | int image = 15; |
| | | if (sImage) image = sImage.toInt(); |
| | | HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); |
| | | if (child != L"no") 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"); |
| | | if (e) |
| | | ExpandChildFolder(0, e); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | if (changeddlb) return 1; |
| | | return OnPreRetrieve(); |
| | | } |
| | | |
| | | int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"del") |
| | | { |
| | | int DelRow = dw_list.GetRow(); |
| | | dw_list.DeleteRow(DelRow); |
| | | return 1; |
| | | } |
| | | else if (updateItem == L"setstate") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | string id = GetEntityIDName(1); |
| | | string entity = ele.selectSingleNode(id).text(); |
| | | //trace(entity); |
| | | SetAgent(L"list", entity); |
| | | if (arg.GetArgString(L"state") != L"") |
| | | //this.dw_list.SetItemString(row, "ApprovalStatus", arg.GetArgString(L"state")); |
| | | dw_list.SetItemString(row, L"ApplyStatus", arg.GetArgString(L"state")); |
| | | if (arg.GetArgString(L"billstatus") != L"") |
| | | { |
| | | xstring billstatus = arg.GetArgString(L"billstatus"); |
| | | xstring statusName = GetBillStatusName(billstatus); |
| | | dw_list.SetItemString(row, L"ApprovalStatus", billstatus); |
| | | dw_list.SetItemDisplayString(row, L"ApprovalStatus", statusName); |
| | | } |
| | | |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | bool IsEmptyQueryStr(string queryStr) |
| | | { |
| | | if (queryStr == L"") return true; |
| | | if (queryStr == L"<items join='and'/>") return true; |
| | | if (queryStr == L"<items join=\"and\"/>") return true; |
| | | //trace(queryStr); |
| | | return false; |
| | | } |
| | | |
| | | //æ£ç´¢ |
| | | int OnPreRetrieve() |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetSelectedItem(); |
| | | if (!hItem) return 1; |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | KXMLDOMElement e1 = tv_folder.GetItemData(hItem); |
| | | string no = e1.getAttribute(L"no"); |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),myDataUrl, L"no", no, L"QueryTxt", m_QueryTxt, L"rows", rows); |
| | | if (x) |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | dw_list.Reset(); |
| | | dw_list.Redraw(); |
| | | dw_goods.Reset(); |
| | | dw_goods.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | /* |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"pageindex", m_pageIndex.toString(),""); //第å 页 |
| | | arg.AddArg(L"pagenumber", m_pageNumber.toString(),""); //æ¯é¡µæ°é |
| | | arg.AddArg(L"QueryTxt", m_QueryTxt,""); //æ¥è¯¢æ¡ä»¶ |
| | | arg.AddArg(L"sType",m_sType,""); |
| | | arg.AddArg(L"sTypeTxt",m_sTypeTxt,""); |
| | | xml x = ViewObject::MakeXml(); |
| | | |
| | | KXMLDOMElement n = m_configDoc.selectSingleNode(L"//list/dwview[@type='dwgrid'][1]"); |
| | | if(n) |
| | | { |
| | | KXMLDOMElement e = n; |
| | | if(e.selectSingleNode(L"@dataUrl")) |
| | | { |
| | | string dataUrl = e.selectSingleNode(L"@dataUrl").text; |
| | | if(dataUrl.left(1)!="/") dataUrl = GetEntityName(1)+"/"+dataUrl; |
| | | getUrl(dataUrl, arg.GetString(), x); |
| | | KXMLDOMElement ele=x.GetXmlDoc().documentElement; |
| | | if(dw_pages.ptr_native_) |
| | | { |
| | | if(ele.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | string s=ele.selectSingleNode(L"@TotalPage").text; //æ»æ°é |
| | | dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | } |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | else |
| | | { |
| | | SetEntityData(arg); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | SetEntityData(arg); |
| | | } |
| | | */ |
| | | } |
| | | |
| | | //å岿°æ® |
| | | int Onhistroydata() |
| | | { |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row > 0) |
| | | { |
| | | KXMLDOMElement e = dw_list.GetRowElement(row); |
| | | xaserverarg& arg = * new xaserverarg; |
| | | string sCustomerID = e.selectSingleNode(L"CustomerID").text(); |
| | | arg.AddArg(L"CustomerID", sCustomerID, L""); |
| | | string sCustomerName = e.selectSingleNode(L"CustomerName").text(); |
| | | arg.AddArg(L"CustomerName", sCustomerName, L""); |
| | | arg.AddArg(L"EntityName", GetEntityName(1), L""); |
| | | arg.AddArg(L"EntityID", GetEntityID(1), L""); |
| | | openUrl(L"/sale/view/SO/xpage/histroydata", &arg); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox䏿 |
| | | int OnSelectDdlb(TEvent* evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | HWND wid = ddlb_1.GetHWND(); |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex =SendMessage(wid, CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]"); |
| | | string no = e2.selectSingleNode(L"@element").text(); |
| | | |
| | | HTREEITEM hItem = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetChildItem(hItem)) |
| | | tv_folder.DeleteItem(tv_folder.GetChildItem(hItem)); |
| | | ExpandFolderItem(hItem, no); |
| | | |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnSelectDataShowDdlb(TEvent* evt, LPARAM p) |
| | | { |
| | | HWND wid = cbx_datashow.GetHWND(); |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessage(wid, CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = cbx_datashow.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring(nIndex + 1) + L"]"); |
| | | rows = e2.selectSingleNode(L"@rows").text(); |
| | | OnPreRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | if (comdid == L"action:bill.new") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | xstring no = publiccode::GetUser().no; |
| | | if (no != L"00303" && no != L"admin") |
| | | { |
| | | KXMLDOMDocument supplier_x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | if ((xstring)supplier_x.text() != L"ä¸å¡å") |
| | | { |
| | | alert(L"å½åè§è²ä¸æ¯ä¸å¡åä¸è½æ°å¢ååï¼è¯·éæ°éæ©è§è²"); |
| | | return 0; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | if (comdid == L"action:bill.annex") |
| | | { |
| | | xstring deptname = publiccode::GetUser().deptname; |
| | | if (deptname == L"éè´é¨") |
| | | { |
| | | return 1; |
| | | } |
| | | |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | xstring guid = dw_list.GetItemString(row, L"SOID"); |
| | | xaserverarg& arg = * new xaserverarg(); |
| | | |
| | | if (guid.length() <= 0)return 1; |
| | | |
| | | arg.AddArg(L"entityid", guid); |
| | | arg.AddArg(L"Type", L"Y"); |
| | | OpenWindow(L"dev:xpage[maint.Document.SO3.v3.vx]", arg); |
| | | |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:bill.histroydata") return Onhistroydata(); |
| | | else if (comdid == L"action:bill.refresh") |
| | | { |
| | | changeddlb = 1; |
| | | HTREEITEM RItem = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetChildItem(RItem)) |
| | | tv_folder.DeleteItem(tv_folder.GetChildItem(RItem)); |
| | | ExpandFolderItem(RItem, L"Category:Customer"); |
| | | tv_folder.ExpandItem(RItem); |
| | | tv_folder.ItemFocus(RItem); |
| | | changeddlb = 0; |
| | | return OnPreRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.saveas") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.SourceRemark") return OnSourceRemark(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSourceRemark() |
| | | { |
| | | xstring name = L"å¤éåå"; |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); |
| | | KXMLDOMNodeList items = x.selectNodes(L"data/Item"); |
| | | KXMLDOMNode t = items.item(0); |
| | | xstring Content = L""; |
| | | if (t.selectSingleNode(L"Content")) |
| | | { |
| | | Content = t.selectSingleNode(L"Content").text(); |
| | | } |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.AddArg(L"value", Content); |
| | | OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | |
| | | if (row < 1) return 1; |
| | | |
| | | //fixed one event only one process |
| | | listwin::OnRowChanged(evt, p); |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | |
| | | xstring SONo = dw_list.GetItemString(row, L"SONo"); |
| | | KXMLDOMDocument x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/maint/item", L"id", SONo); |
| | | if (x) |
| | | dw_goods.Retrieve(x); |
| | | else |
| | | dw_goods.Reset(); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | |
| | | x = ViewObject::RetrieveData(GetServerUrl(),L"/sale/data/SaleOrder/maint/itemwithsource", L"id", SONo); |
| | | if (x) |
| | | dw_source.Retrieve(x); |
| | | else |
| | | dw_source.Reset(); |
| | | dw_source.Redraw(); |
| | | dw_source.SetReadOnly(true); |
| | | |
| | | xutil::RestoreCursor(hCursor); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int AttachListon() |
| | | { |
| | | AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&SO3list::OnTreeSelChanged); //æ éæ© |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&SO3list::OnRowChanged);//ç»å®è¡æ´æ¹è§¦åäºä»¶OnRowChanged |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listwin::OnDoubleClicked); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&SO3list::OnSelectDdlb);//ç»å®ä¸ææ¡æ´æ¹è§¦åäºä»¶OnSelectDdlb |
| | | AttachEvent(L"cbx_datashow", L"CBN_SELCHANGE", (FEvent)&SO3list::OnSelectDataShowDdlb);//ç»å®éæ©æ°æ®æ¾ç¤ºä¸æå表äºä»¶OnSelectDataShowDdlb |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | changeddlb = 0; |
| | | listwin::onload(); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | cbx_datashow = GetControl(L"cbx_datashow"); |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(),L"/sale/view/SaleOrder/template/item"); |
| | | dw_source = GetControl(L"dw_source"); |
| | | dw_source.openUrl(GetServerUrl(), L"/sale/view/SaleOrder/template/sourceitem"); |
| | | |
| | | dw_goods.SetColumnState(L"ItemID", false); |
| | | dw_goods.SetColumnState(L"LineType", false); |
| | | dw_goods.SetColumnState(L"Brand", false); |
| | | dw_goods.SetColumnState(L"Assortment", false); |
| | | dw_goods.SetColumnState(L"ClassifyID", false); |
| | | dw_goods.SetColumnState(L"UnitFreight", false); |
| | | //dw_goods.SetColumnState(L"CName",false);//éèå |
| | | |
| | | dw_goods.SetColumnState(L"Brand", false); |
| | | dw_goods.SetColumnState(L"SKUNo", false); |
| | | dw_goods.SetColumnState(L"SOLineNo", false); |
| | | dw_goods.SetColumnState(L"CustomerPONo", false); |
| | | dw_goods.SetColumnState(L"ScheduleShipDate", false); |
| | | |
| | | dw_goods.SetColumnState(L"PackTechNote", false); |
| | | dw_goods.SetColumnState(L"EnquiryPriceListID", false); |
| | | dw_goods.SetColumnState(L"Submitter", false); |
| | | dw_goods.SetColumnState(L"POSupplierID", false); |
| | | dw_goods.SetColumnState(L"QuoteLineID", false); |
| | | |
| | | dw_list.SetColumnState(L"CreatorID", false); |
| | | dw_list.SetColumnState(L"SOID", false); |
| | | |
| | | |
| | | string groupname = publiccode::GetUser().groupname; |
| | | if (groupname == L"éè´å°ç»") |
| | | { |
| | | dw_list.SetColumnState(L"USDAmount", false); |
| | | dw_list.SetColumnState(L"RMBAmount", false); |
| | | |
| | | dw_goods.SetColumnState(L"UnitPrice", false); |
| | | dw_goods.SetColumnState(L"Amount", false); |
| | | dw_goods.SetColumnState(L"UnitCommPrice", false); |
| | | dw_goods.SetColumnState(L"CommissionRate", false); |
| | | |
| | | dw_source.SetColumnState(L"UnitPrice", false); |
| | | dw_source.SetColumnState(L"Amount", false); |
| | | dw_source.SetColumnState(L"FOBAmount", false); |
| | | dw_source.SetColumnState(L"BuyUnitPrice", false); |
| | | dw_source.SetColumnState(L"BuyAmount", false); |
| | | dw_source.SetColumnState(L"CostRate", false); |
| | | } |
| | | |
| | | rows = L"500"; |
| | | myDataUrl = L"/sale/data/SaleOrder/folder/list"; |
| | | urlTree = L"/sale/data/SaleOrder/folder"; |
| | | tv_folder = GetControl(L"tv_folder"); |
| | | tv_folder.SetLineAtRoot(true); |
| | | InitialFolder(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | listwin::onloaded(); |
| | | |
| | | //attach my control event |
| | | AttachListon(); |
| | | |
| | | dw_list.SetColumnState(L"SOID", false); |
| | | |
| | | HTREEITEM hItem = tv_folder.GetRootItem(); |
| | | ExpandFolderItem(hItem, L"Category:Customer"); |
| | | tv_folder.ExpandItem(hItem); |
| | | //tv_folder.ItemFocus(tv_folder.GetChildItem(hItem)); |
| | | tv_folder.ItemFocus(hItem); |
| | | |
| | | |
| | | return -1; |
| | | } |
| | | |
| | | int ProcessUsedArg(xaserverarg arg) |
| | | { |
| | | HTREEITEM hItem = tv_folder.GetCaretItem(); |
| | | if (hItem ) return 1; |
| | | KXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | xstring no = e.getAttribute(L"no"); |
| | | if (no.find(L"Customer:") >= 0) |
| | | { |
| | | arg.AddArg(L"CustomerID", e.getAttribute(L"id")); |
| | | xstring name = e.getAttribute(L"name"); |
| | | if (name.find(L"(L") >= 0) name = name.left(name.find(L"(L")); |
| | | arg.AddArg(L"CustomerName", name); |
| | | } |
| | | return 1; |
| | | } |
| | | }; |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "dev:code[Data.resource.config.vx]" |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | resourceselectRole is extend DataRConfig; |
| | | about resourceselectRole |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | int ForChild() |
| | | { |
| | | this.dw_list.SetReadOnly(true); |
| | | return 0; |
| | | } |
| | | |
| | | int OnSelectAll() |
| | | { |
| | | if(this.dw_list.GetRowCount() > 0 ) |
| | | this.dw_list.SelectRow(1,true); |
| | | |
| | | this.dw_list.SelectRow(0,true); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectNo() |
| | | { |
| | | this.dw_list.SelectRow(0,false); |
| | | this.dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOk() |
| | | { |
| | | xdwgrid__ dw_param = this.GetParam(); |
| | | if (dw_param) |
| | | { |
| | | int row = this.dw_list.GetNextSelectRow(1); |
| | | int dw_row = dw_param.GetRowCount(); |
| | | while (row>0){ |
| | | msxml::IXMLDOMElement e = this.dw_list.GetRowElement(row); |
| | | string scetegory = e.selectSingleNode("cetegory").text; |
| | | string sResource = e.selectSingleNode("resource").text; |
| | | string sName = e.selectSingleNode("name").text; |
| | | string sResConfigID = e.selectSingleNode("ResConfigID").text; |
| | | dw_row += 1; |
| | | dw_param.InsertRow(-1); |
| | | dw_param.SetItemString(dw_row,"cetegory",scetegory); |
| | | dw_param.SetItemString(dw_row,"resource",sResource); |
| | | dw_param.SetItemString(dw_row,"name",sName); |
| | | dw_param.SetItemString(dw_row,"ResConfigID",sResConfigID); |
| | | |
| | | this.dw_list.SelectRow(row,false); |
| | | row = this.dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | this.dw_list.Redraw(); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCancel() |
| | | { |
| | | win__::CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="SelectAll") OnSelectAll(); |
| | | else if (comdid=="SelectNo") OnSelectNo(); |
| | | else if (comdid=="Ok") OnOk(); |
| | | else if (comdid=="Cancel") OnCancel(); |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | DataRConfig::onload(); |
| | | this.dw_list.SetSelectionMode(3); |
| | | |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | } |
| | | ] |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "lang.vl" |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "sys.base.vl" |
| | | |
| | | use "dev:vm[xcell.vm]" |
| | | |
| | | unit vbusiness.vpage |
| | | [ |
| | | Roleconfig is extend TProject; |
| | | about Roleconfig |
| | | [ |
| | | field: |
| | | |
| | | method: |
| | | [ |
| | | treeview__ tv_menu; |
| | | xdwtable__ dw_list; |
| | | xdwgrid__ dw_param; |
| | | xdwgrid__ dw_role; |
| | | string m_status; |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = win__::GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml+""; |
| | | SetAgentNodeContent (anode,s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createTree(string id, int parentItem) |
| | | { |
| | | if(treeview__::GetChildItem(tv_menu.GetId(), parentItem) > 0) return 0; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("pid",id); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[leftFrame.xq]",arg.GetString(),x)!=1) |
| | | //if(url::get(m_iface+"/pref/tree",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/tree",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("items/item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(s - i - 1); |
| | | string id = xitem.selectSingleNode("ModuleID").text; |
| | | string Name=""; |
| | | if(xitem.selectSingleNode("ModuleName")) Name=xitem.selectSingleNode("ModuleName").text; |
| | | string image = 15; |
| | | if(xitem.selectSingleNode("ModuelImage")) image=xitem.selectSingleNode("ModuelImage").text; |
| | | int curItem=treeview__::InsertItem(tv_menu.GetId(), parentItem,0,Name,id,image.toInt()); |
| | | string child=xitem.selectSingleNode("@child").text;//item.getAttribute("HasChild"); |
| | | if (child != "0") |
| | | treeview__::SetItemChild1(tv_menu.GetId(), curItem,1); |
| | | } |
| | | } |
| | | |
| | | int OnNew() |
| | | { |
| | | int i =1; |
| | | while(dw_list.GetColumnName(i) != "") |
| | | { |
| | | dw_list.SetItemString(1, i, ""); |
| | | i++; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | x.LoadXml("<item><ModuelPage/><status _displaystring='å¯ç¨'>Y</status><type _displaystring='èå'>0</type><ModuelImage>17</ModuelImage><ModuelParam><args/></ModuelParam><roles/></item>"); |
| | | dw_list.Retrieve(x); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | dw_param.Retrieve(x.GetXmlDoc().selectSingleNode("item/ModuelParam/args")); |
| | | dw_param.ResetUpdateStatus(); |
| | | dw_param.Redraw(); |
| | | dw_role.Retrieve(x.GetXmlDoc().selectSingleNode("item/roles")); |
| | | dw_role.ResetUpdateStatus(); |
| | | dw_role.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAddRow(xdwgrid__ dw) |
| | | { |
| | | dw.InsertRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDelRow(xdwgrid__ dw) |
| | | { |
| | | int row = dw.GetRow(); |
| | | if(row<1 || row > dw.GetRowCount()) return -1; |
| | | dw.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | /* |
| | | int openUrl(string aurl, param para) |
| | | { |
| | | int pos = aurl.find("/",0); |
| | | if(pos<0) return ""; |
| | | string iface = aurl.left(pos); |
| | | string root = aurl.mid(pos + 1,9999); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | if( iface.find(".vface",0)<0 ) |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | string typ = iface.mid(iface.find(".",0) + 1,9999); |
| | | xaserver__::LoadUrl("","dev:"+typ+"["+iface+"]","",x); |
| | | } |
| | | var doc = x.GetXmlDoc(); |
| | | var n = doc.selectSingleNode("//resource[@url='" + root+"']/@src"); |
| | | if(n) |
| | | { |
| | | string xq = n.text; |
| | | return OpenWindow(xq, para); |
| | | }else |
| | | { |
| | | n = doc.selectSingleNode("//group[@for='worknode']/resource[@url='" + root+"']"); |
| | | if(n) |
| | | { |
| | | string vface = n.selectSingleNode("@vface").text; |
| | | string view = n.selectSingleNode("@view").text; |
| | | string config = n.selectSingleNode("@config").text; |
| | | if(config != "" ) |
| | | { |
| | | xaserverarg__ arg = para; |
| | | arg.AddArg("config",config); |
| | | } |
| | | |
| | | if(vface=="."|| vface=="") |
| | | { |
| | | var v = doc.selectSingleNode("//resource[@url='" + view+"']/@src"); |
| | | if(v) |
| | | { |
| | | return OpenWindow(v.text, para); |
| | | } |
| | | }else |
| | | return openUrl(vface+"/"+view,para); |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | */ |
| | | int OnAddRole() |
| | | { |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //OpenWindow("dev:xpage[selectRole.vx]", arg); |
| | | //openUrl(m_vface+"/xpage/role/select/user", arg); |
| | | openUrl("/sale/view/Role.config/xpage/role/select/user", arg); |
| | | string str = arg.GetArgString("item"); |
| | | if(str == "") return -1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | x.LoadXml(str); |
| | | var list=x.GetXmlDoc().selectNodes("items/item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | int row = dw_role.GetRowCount() + 1; |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | string id = ""+xitem.selectSingleNode("@id").text; |
| | | string name=""+xitem.selectSingleNode("@name").text; |
| | | string tpy=""+xitem.selectSingleNode("@type").text; |
| | | dw_role.InsertRow(0); |
| | | dw_role.SetItemString(row + i, "id", id); |
| | | dw_role.SetItemString(row + i, "name", name); |
| | | dw_role.SetItemString(row + i, "type", tpy); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDel() |
| | | { |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllTo(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | string id = e.selectSingleNode("@guid").text; |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", id); |
| | | //trace(id); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[deleteModule.xq]",arg.GetString(),x)!=1) |
| | | //if(url::get(m_iface+"/pref/delete",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/delete",arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("å é¤åºé!"); |
| | | return 0; |
| | | } |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("请å
å é¤å项!"); |
| | | return 0; |
| | | } |
| | | int sitem = treeview__::GetSelectedItem(tv_menu.GetId()); |
| | | treeview__::DeleteItem(tv_menu.GetId(), sitem); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_param.AcceptText(); |
| | | dw_list.AcceptText(); |
| | | /*int aa=1,bb=1; |
| | | xpoint p; |
| | | dw_list.getNullCell(p); |
| | | int xx = p.x; |
| | | trace(xx); |
| | | int yy = p.y; |
| | | trace(yy); |
| | | string zz = dw_list.GetColumnName(yy); |
| | | trace(zz);*/ |
| | | |
| | | int m = treeview__::GetSelectedItem(tv_menu.GetId()); |
| | | if(m == 0) return -1; |
| | | |
| | | int n = treeview__::GetRootItem(tv_menu.GetId()); |
| | | if(m == n) |
| | | if(m_status == "update.modify") |
| | | { |
| | | alert("æ ¹èç¹ä¸è½ä¿®æ¹!"); |
| | | return 1; |
| | | } |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.DwUpdateAllTo(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | e.SetAttribute(m_status, "1"); |
| | | //trace(e.xml); |
| | | //return 1; |
| | | |
| | | xml__ x1 = new xml__; |
| | | x1.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_param.DwUpdateAllTo(x1.GetXmlDoc()); |
| | | msxml::IXMLDOMElement p = x1.GetXmlDoc().documentElement; |
| | | e.AppendChild(p); |
| | | |
| | | xml__ x2 = new xml__; |
| | | x2.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_role.DwUpdateAllToEx(x2.GetXmlDoc()); |
| | | msxml::IXMLDOMElement r = x2.GetXmlDoc().documentElement; |
| | | e.AppendChild(r); |
| | | |
| | | //trace(e.xml); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", e.xml); |
| | | arg.AddArg("dbmap", "Role.config.dbmap"); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[saveModule.xq]",arg.GetString(),x)!=1) |
| | | //if(url::get(m_iface+"/pref/save",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/save",arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ä¿ååºé!"); |
| | | return 0; |
| | | } |
| | | //trace(x.GetXml()); |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert("ä¿ååºé2!"); |
| | | return 0; |
| | | } |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_param.ResetUpdateStatus(); |
| | | dw_role.ResetUpdateStatus(); |
| | | |
| | | string id = e.selectSingleNode("@guid").text; |
| | | string name = ""; |
| | | if(e.selectSingleNode("ModuleName")) |
| | | name = e.selectSingleNode("ModuleName").text; |
| | | string image = 15; |
| | | if(e.selectSingleNode("ModuelImage")) |
| | | image = e.selectSingleNode("ModuelImage").text; |
| | | int sitem = treeview__::GetSelectedItem(tv_menu.GetId()); |
| | | if(m_status == "update.new") |
| | | treeview__::InsertChildItem(tv_menu.GetId(), sitem, name, id, image.toInt()); |
| | | else if(m_status == "update.modify") |
| | | treeview__::SetItemLabel(tv_menu.GetId(), sitem, name); |
| | | |
| | | if(m_status == "update.new") |
| | | { |
| | | OnNew(); |
| | | int sitem = treeview__::GetSelectedItem(tv_menu.GetId()); |
| | | string xxid = treeview__::GetItemData(tv_menu.GetId(), sitem); |
| | | dw_list.SetItemString(1, "ModulePID", xxid); |
| | | } |
| | | alert("ä¿åæå!"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | if(comdid == "New") |
| | | { |
| | | m_status = "update.new"; |
| | | OnNew(); |
| | | int sitem = treeview__::GetSelectedItem(tv_menu.GetId()); |
| | | string id = treeview__::GetItemData(tv_menu.GetId(), sitem); |
| | | dw_list.SetItemString(1, "ModulePID", id); |
| | | } |
| | | else if(comdid == "addparam") |
| | | OnAddRow(dw_param); |
| | | else if(comdid == "delparam") |
| | | OnDelRow(dw_param); |
| | | else if(comdid == "addrole") |
| | | OnAddRole(); |
| | | else if(comdid == "delrole") |
| | | OnDelRow(dw_role); |
| | | else if(comdid == "Del") |
| | | OnDel(); |
| | | else if(comdid == "Save") |
| | | OnSave(); |
| | | |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 0; |
| | | } |
| | | |
| | | int OnTreeMoveNode(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref TVNNMHDR nmtv = evt.pnmh; |
| | | int xfrom = nmtv.FromItem; |
| | | int xto = nmtv.ToItem; |
| | | |
| | | int ret = win__::MessageBox(this.GetHWND(), "ç¡®å®ç§»å¨èç¹ï¼","æç¤ºï¼",1); |
| | | //trace(ret); |
| | | if(ret == 2) |
| | | { |
| | | treeview__::DeleteItem(tv_menu.GetId(), xto); |
| | | return -1; |
| | | } |
| | | |
| | | string fid = treeview__::GetItemData(tv_menu.GetId(), xfrom); |
| | | int xpto = treeview__::GetParentItem(tv_menu.GetId(), xto); |
| | | string tid = treeview__::GetItemData(tv_menu.GetId(), xpto); |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("from", fid); |
| | | arg.AddArg("to", tid); |
| | | trace(arg.GetString()); |
| | | //if(url::get(m_iface+"/pref/tree/move",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/tree/move",arg.GetString(),x)!=1) |
| | | { |
| | | trace("error:"+x.GetXml()); |
| | | alert("ç§»å¨èç¹åºé!"); |
| | | treeview__::DeleteItem(tv_menu.GetId(), xto); |
| | | return 0; |
| | | } |
| | | treeview__::DeleteItem(tv_menu.GetId(), xfrom); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | string id = treeview__::GetItemData(tv_menu.GetId(), sitem); |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | createTree(id, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | string id = treeview__::GetItemData(tv_menu.GetId(), hItem); |
| | | //trace(id); |
| | | m_status = "update.modify"; |
| | | |
| | | OnNew(); |
| | | |
| | | int xItem = treeview__::GetRootItem(tv_menu.GetId()); |
| | | if(hItem == xItem) |
| | | { |
| | | string label = treeview__::GetItemLabel(tv_menu.GetId(), xItem); |
| | | dw_list.SetItemString(1, "ModuleName", label); |
| | | dw_list.ResetUpdateStatus(); |
| | | return 0; |
| | | } |
| | | |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id",id); |
| | | //if(xaserver__::ExecXQuery(GetServerUrl(),"[leftMenu.xq]",arg.GetString(),x)!=1) |
| | | //if(url::get(m_iface+"/pref/maint",arg.GetString(),x)!=1) |
| | | if(url::get("/sale/data/Role.config/pref/maint",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | dw_list.Retrieve(x); |
| | | dw_list.ResetUpdateStatus(); |
| | | dw_list.Redraw(); |
| | | if(x.GetXmlDoc().selectSingleNode("item/ModuelParam/args")) |
| | | { |
| | | dw_param.Retrieve(x.GetXmlDoc().selectSingleNode("item/ModuelParam/args")); |
| | | dw_param.ResetUpdateStatus(); |
| | | dw_param.Redraw(); |
| | | } |
| | | if(x.GetXmlDoc().selectSingleNode("item/roles")) |
| | | { |
| | | dw_role.Retrieve(x.GetXmlDoc().selectSingleNode("item/roles")); |
| | | dw_role.ResetUpdateStatus(); |
| | | dw_role.SetReadOnly(true); |
| | | dw_role.Redraw(); |
| | | } |
| | | //msxml::IXMLDOMElement e = x.GetXmlDoc().documentElement; |
| | | |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSetFocus(ref TEvent evt,int p) |
| | | { |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string colname=hdr.colname; |
| | | if(colname == "type") |
| | | { |
| | | string value = hdr.data; |
| | | //trace(colname, value); |
| | | if(value == "0") |
| | | dw_list.SetItemString(1, "ModuelImage", "17"); |
| | | else |
| | | dw_list.SetItemString(1, "ModuelImage", "16"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDBClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string colname=hdr.colname; |
| | | if(colname == "type") |
| | | { |
| | | string value = hdr.data; |
| | | //trace(colname, value); |
| | | if(value == "0") |
| | | dw_list.SetItemString(1, "ModuelImage", "17"); |
| | | else |
| | | dw_list.SetItemString(1, "ModuelImage", "16"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemError(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | string colname=hdr.colname; |
| | | trace(colname); |
| | | int e = hdr.idFrom; |
| | | trace(e); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_menu = new treeview__; |
| | | tv_menu.setNativePointer(GetControl("tv_folder")); |
| | | int hItem = treeview__::InsertChildItem(tv_menu.GetId(), 0, "模å", "", 17); |
| | | createTree("null", hItem); |
| | | treeview__::ExpandItemEx(tv_menu.GetId(), hItem); |
| | | |
| | | dw_list = new xdwtable__; |
| | | dw_list.setNativePointer(GetControl("dw_base")); |
| | | //dw_list.SetDataObject(GetServerUrl(), "dev:sheet[leftFrame.tpl/module]"); |
| | | //dw_list.openUrl(m_vface+"/template/role/config/module"); |
| | | dw_list.openUrl("/sale/view/Role.config/template/role/config/module"); |
| | | dw_list.SetColHeaderHeight(0); |
| | | dw_list.SetRowSelectorWidth(0); |
| | | dw_list.SetScrollState(false); |
| | | |
| | | dw_param = new xdwgrid__; |
| | | dw_param.setNativePointer(GetControl("dw_param")); |
| | | //dw_param.SetDataObject(GetServerUrl(), "dev:sheet[leftFrame.tpl/param]"); |
| | | //dw_param.openUrl(m_vface+"/template/role/config/param"); |
| | | dw_param.openUrl("/sale/view/Role.config/template/role/config/param"); |
| | | |
| | | dw_role = new xdwgrid__; |
| | | dw_role.setNativePointer(GetControl("dw_role")); |
| | | //dw_role.SetDataObject(GetServerUrl(), "dev:sheet[leftFrame.tpl/role]"); |
| | | //dw_role.openUrl(m_vface+"/template/role/config/role"); |
| | | dw_role.openUrl("/sale/view/Role.config/template/role/config/role"); |
| | | dw_role.SetReadOnly(false); |
| | | |
| | | AttachEvent("tv_folder", "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | AttachEvent("tv_folder", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("tv_folder", "TVN_ENDDRAG",OnTreeMoveNode); |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | AttachEvent("dw_base","DWV_ITEMCHANGED",OnItemChanged); |
| | | AttachEvent("dw_base","DWV_DOUBLECLICKED",OnDBClick); |
| | | AttachEvent("dw_base","DWV_ITEMERROR",OnItemError); |
| | | |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | |
| | | unit vbusiness |
| | | [ |
| | | class SysLoginRecord : public frame |
| | | { |
| | | xdwgrid dw_logrecord; |
| | | xdwtable dw_arg; |
| | | int OnRetrieve() |
| | | { |
| | | xcontrol xc_text =GetControl("QueryTxt"); |
| | | xcontrol xc_cbx = GetControl("cbx_type"); |
| | | string ls_querytxt; |
| | | string ls_querytype; |
| | | ls_querytxt = xc_text.GetText(); |
| | | ls_querytype = xc_cbx.GetText(); |
| | | xml x = new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sType",ls_querytype); |
| | | arg.AddArg("QueryText",ls_querytxt); |
| | | arg.AddArg("QueryArg",GetQueryArg()); |
| | | //alert(ls_querytxt); |
| | | if (url::get("/sale/data/Total3/total/GDNTotal/Item/GetSysLoginLog",arg.GetString(),x) == 1) |
| | | { |
| | | //trace(x.GetXml()); |
| | | dw_logrecord.Retrieve(x); |
| | | dw_logrecord.Redraw(); |
| | | dw_logrecord.SetSelectionMode(1); |
| | | } |
| | | else |
| | | alert("æ¥ä¸å°"); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor = xutil::SetCursorWait(); |
| | | if(comdid=="ContSearch") |
| | | OnRetrieve(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | string GetQueryArg() |
| | | { |
| | | dw_arg.AcceptText(); |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_arg.DwUpdateAllTo(x.GetXmlDoc()); |
| | | return x.GetXml(); |
| | | } |
| | | |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_logrecord = GetControl("dw_logrecord"); |
| | | dw_logrecord.openUrl("/sale/view/SysUser/template/SysLoginRecord"); |
| | | dw_arg = GetControl("dw_arg"); |
| | | dw_arg.openUrl("/sale/view/AR/template/queryarg"); |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | return 0; |
| | | } |
| | | int onloaded() |
| | | { |
| | | //alert("xxx"); |
| | | OnAttachEvent(); |
| | | //OnRetrieve(); |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:code[pa.tpp]" |
| | | use "list.vl" |
| | | |
| | | unit vbusiness.xpage |
| | | [ |
| | | SysUser is extend list; |
| | | about SysUser |
| | | [ |
| | | |
| | | method: |
| | | [ |
| | | treeview__ tv_usergroup; |
| | | xdwgrid__ dw_user; |
| | | xnode__ m_agentNode; |
| | | string strJobID; |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent (anode,s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(param p) |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string str = this.m_QueryTxt; |
| | | //trace(ele.xml); |
| | | //alert(str); |
| | | arg.AddArg("guid",str); |
| | | //trace(strJobID); |
| | | if (xaserver__::ExecXQuery("","[list.SysUser.xq]",arg.GetString(),x) == 1) |
| | | { |
| | | dw_user.AcceptText(); |
| | | dw_user.Retrieve(x); |
| | | dw_user.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | int rootItem = treeview__::GetRootItem(wid); |
| | | //if (hItem <=0 || hItem == rootItem) |
| | | // return 0; |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,hitem); |
| | | //trace("ok"); |
| | | if (ele) |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | strJobID = ele.selectSingleNode("@JobID").text; |
| | | //trace(ele.xml); |
| | | //alert(strJobID); |
| | | arg.AddArg("guid",strJobID); |
| | | //trace(strJobID); |
| | | if (xaserver__::ExecXQuery("","[list.SysUser.xq]",arg.GetString(),x) == 1) |
| | | { |
| | | dw_user.AcceptText(); |
| | | dw_user.Retrieve(x); |
| | | dw_user.Redraw(); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int xmImport() |
| | | { |
| | | |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if (!hitem) |
| | | { |
| | | alert("è¯·éæ©èä½ï¼"); |
| | | return 0; |
| | | } |
| | | OpenWindow("dev:xpage[UserImport.vx]",this); |
| | | //openUrl("ç³»ç»ç¨æ·.vface/xpage/SysUser/UserImport", this); |
| | | return 1; |
| | | } |
| | | int OnSave() |
| | | { |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_user.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content",x.GetXml()); |
| | | arg.AddArg("dbmap","SysUser.dbmap"); |
| | | if(getUrl("/sale/data/SysUser/SysUser",arg.GetString(),x)!=1) |
| | | { |
| | | //trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败"); |
| | | } |
| | | else{ |
| | | if(x.GetXmlDoc().selectSingleNode("erroe")) |
| | | { |
| | | alert("ä¿ååºé2! "); |
| | | return 0; |
| | | } |
| | | //trace(x.GetXml()); |
| | | dw_user.ResetUpdateStatus(); |
| | | win__::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | } |
| | | |
| | | /* arg.AddArg("xdata",x.GetXml()); |
| | | //arg.AddArg("jobguid",strJobID); |
| | | //trace(x.GetXml()); |
| | | //trace(strJobID); |
| | | //if (getUrl("/sale/data/SysUser/SysUser",arg.GetString(),x) != 1) |
| | | //trace(xaserver__::ExecXAction(GetServerUrl(),"[SysUser.xa]",arg.GetString(),x)); |
| | | if (xaserver__::ExecXAction(GetServerUrl(),"[SysUser.xa]",arg.GetString(),x)!=1) |
| | | { |
| | | //trace("error:"+x.GetXml()); |
| | | alert("ä¿å失败"); |
| | | } |
| | | else{ |
| | | if(x.GetXmlDoc().selectSingleNode("ERROR")) |
| | | { |
| | | alert("ä¿ååºé2! "); |
| | | return 0; |
| | | } |
| | | win__::MessageBox(GetHWND(),"ä¿åæåï¼","æç¤º",0); |
| | | }*/ |
| | | return 1; |
| | | } |
| | | int OnAddRow() |
| | | { |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if(hitem==0) |
| | | { |
| | | alert("请å
éæ©èä½ç±»åï¼"); |
| | | } |
| | | else |
| | | { |
| | | int row = dw_user.InsertRow(0); |
| | | dw_user.SetItemString(row,"Status","Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnInsertRow() |
| | | { |
| | | int wid = tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | if(hitem==0) |
| | | { |
| | | alert("请å
éæ©èä½ç±»åï¼"); |
| | | } |
| | | else |
| | | { |
| | | int crow=dw_user.GetRow(); |
| | | int row=dw_user.InsertRow(crow); |
| | | dw_user.SetItemString(row,"Status","Y"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row=dw_user.GetRow(); |
| | | dw_user.DeleteRow(row); |
| | | return 1; |
| | | } |
| | | |
| | | int OnJobType() |
| | | { |
| | | openUrl("ç»ç»æ¶æ.vface/worknode/Hr/HrJob"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnClicked(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref DWNMHDR hdr = evt.pnmh; |
| | | int row = hdr.row; |
| | | int col=hdr.col ; |
| | | string colname=dw_user.GetColumnName(col); |
| | | msxml::IXMLDOMElement xrow = dw_user.GetRowElement(row); |
| | | string BindComputer=xrow.selectSingleNode("BindComputer").text; |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | if(BindComputer != "" ) |
| | | { |
| | | arg.AddArg("BindComputer",BindComputer); |
| | | } |
| | | |
| | | string comdid; |
| | | if(colname=="BindComputer") |
| | | { |
| | | openUrl("ç³»ç»ç¨æ·.vface/xpage/SysUser/BindComputer/dialog", arg); |
| | | comdid = arg.GetArgString("comdid"); |
| | | if(comdid=="ok") |
| | | { |
| | | string strxml = arg.GetArgString("xml"); |
| | | dw_user.SetItemDisplayString(row,colname,strxml); |
| | | dw_user.SetItemString(row,colname,strxml); |
| | | dw_user.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnResetPass() |
| | | { |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | int pt = arg.CreateInstance(); |
| | | arg.setNativePointer(pt); |
| | | |
| | | int row = dw_user.GetRow(); |
| | | if(row < 1) return 1; |
| | | arg.AddArg("user", dw_user.GetItemString(row,"EmployeeNo")); |
| | | |
| | | OpenWindow("dev:xpage[ResetUserPassDlg.vx]",pt); |
| | | return 1; |
| | | } |
| | | |
| | | int Onlog() |
| | | { |
| | | openUrl("/sale/view/SysUser/xpage/SysUser/SysLoginRecord"); |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid =="Save") OnSave(); |
| | | else if (comdid =="AddRow") OnAddRow(); |
| | | else if (comdid =="InsertRow") OnInsertRow(); |
| | | else if (comdid =="DeleteRow") OnDeleteRow(); |
| | | else if (comdid =="JobType") OnJobType(); |
| | | else if (comdid=="xmImport") xmImport(); |
| | | else if (comdid == "xmLog") Onlog(); |
| | | else if(comdid=="_cb_grid_search") return GridSearchEx(); |
| | | else if(comdid=="xmResetPass") return OnResetPass(); |
| | | else if(comdid=="xmResetPassEx") OpenWindow("dev:xpage[SysForcePassward.vx]"); |
| | | return 0; |
| | | } |
| | | |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_usergroup", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | //AttachEvent("dw_user","DWV_ITEMBEINGEDIT",OnClicked); |
| | | AttachEvent("dw_user","DWV_DOUBLECLICKED",OnClicked); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | m_agentNode = new xnode__; |
| | | |
| | | tv_usergroup = new treeview__; |
| | | tv_usergroup.setNativePointer(this.GetControl("tv_usergroup")); |
| | | dw_user = new xdwgrid__; |
| | | dw_user.setNativePointer(this.GetControl("dw_user")); |
| | | dw_user.SetDataObject(GetServerUrl(),"dev:sheet[SysUser.tpl/UserList]"); |
| | | dw_user.SetReadOnly(true); |
| | | dw_user.SetSelectionMode(1); |
| | | |
| | | OnInitial(); |
| | | int wid = tv_usergroup.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid,root); |
| | | |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(xml__::CreateInstance()); |
| | | x.LoadXml("<Config/>"); |
| | | this.m_configDoc = x.GetXmlDoc(); |
| | | rowSearch("ç³»ç»ç¨æ·.vface/template/SysUser/list"); |
| | | GridSearchEx(); |
| | | |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class TestRetrieveingWin: public xframe |
| | | { |
| | | //xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="RetrieveFinished") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "win.vl" |
| | | use "treeview.vm" |
| | | use "dev:vm[xdwgrid.vm]" |
| | | use "dev:vm[xdwtable.vm]" |
| | | use "pref.vl" |
| | | use "dev:vm[xml.vm]" |
| | | use "dev:vm[xaserverarg.vm]" |
| | | use "dev:vm[xaserver.vm]" |
| | | use "dev:vm[xutil.vm]" |
| | | use "dev:code[SysUser.vx]" |
| | | use "frame.vl" |
| | | use "file.vl" |
| | | unit vbusiness.xpage |
| | | [ |
| | | UserImport is extend frame; |
| | | about UserImport |
| | | [ |
| | | field: |
| | | [ |
| | | SysUser lw_obj; |
| | | xdwgrid__ dw_list; |
| | | treeview__ tv_org; |
| | | xnode__ m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | string m_sTxt; |
| | | string is_orgid; |
| | | ] |
| | | |
| | | method: |
| | | [ |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode__ anode = new xnode__; |
| | | anode.setNativePointer(GetAgentNode(xfNodeAgentArea)); |
| | | var xframeElement = GetElement(); |
| | | var agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | SetAgentNodeContent (anode,s); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | SetAgent(); |
| | | //é置工å
·æ¡ |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string ls_orgid) |
| | | { |
| | | |
| | | xml__ x=new xml__; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg__ arg = new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("OrgID",ls_orgid); |
| | | //trace(ls_orgid); |
| | | //if (xaserver__::ExecXQuery(GetServerUrl(),"[MSSqlHrEmployee.xq]",arg.GetString(),x) == 1) |
| | | if (url::get("SysUser.config/UserSelect.xq",arg.GetString(),x) == 1) |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | //trace(x.GetXml()); |
| | | return 1; |
| | | } |
| | | |
| | | int OnOK() |
| | | { |
| | | if (GetParam()) |
| | | { |
| | | lw_obj = new SysUser; |
| | | lw_obj.setNativePointer(GetParam()); |
| | | lw_obj = GetParam(); |
| | | } |
| | | else |
| | | return 0; |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | trace(row); |
| | | if (row<1) |
| | | { |
| | | alert("è¯·éæ©äººå!"); |
| | | return 1; |
| | | } |
| | | |
| | | string sPositionID,sPositionName; |
| | | string sOrgID,sOrgName; |
| | | string sJobID,sJobName; |
| | | int wid = lw_obj.tv_usergroup.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,hitem); |
| | | |
| | | |
| | | while (row>0) |
| | | { |
| | | trace(row); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | trace(e.xml); |
| | | string sEmployeeNo = e.selectSingleNode("EmployeeNo").text+""; |
| | | string sOldEmpNo = e.selectSingleNode("OldEmpNo").text+""; |
| | | string sPersonID = e.selectSingleNode("PersonID").text+""; |
| | | string sPersonName = e.selectSingleNode("Name").text+""; |
| | | string sPassWord = xutil__::MD5(sOldEmpNo); |
| | | |
| | | /* |
| | | xml__ xx = new xml__; |
| | | xx.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("userno",sOldEmpNo); |
| | | arg.AddArg("password",sPassWord); |
| | | if(url::get("/sale/data/SysUser/GetOldPassWord",arg.GetString(),xx)==1) |
| | | { |
| | | if(xx.GetXml()!="") |
| | | { |
| | | msxml::IXMLDOMElement ex = xx.GetXmlDoc().documentElement; |
| | | sPassWord = ""+ex.text; |
| | | } |
| | | }*/ |
| | | |
| | | int nRow = lw_obj.dw_user.InsertRow(0); |
| | | lw_obj.dw_user.SetItemString(nRow,"EmployeeNo",sEmployeeNo); |
| | | lw_obj.dw_user.SetItemString(nRow,"UserName",sOldEmpNo); |
| | | lw_obj.dw_user.SetItemString(nRow,"PassWord",sPassWord); |
| | | lw_obj.dw_user.SetItemString(nRow,"PersonID",sPersonID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"PersonID",sPersonName); |
| | | lw_obj.dw_user.SetItemString(nRow,"Status","Y"); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"Status","ææ"); |
| | | lw_obj.dw_user.SetItemString(nRow,"OldEmpNo",sOldEmpNo); |
| | | /* |
| | | lw_obj.dw_user.SetItemString(nRow,"PositionID",sPositionID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"PositionID",sPositionName); |
| | | lw_obj.dw_user.SetItemString(nRow,"OrgID",sOrgID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"OrgID",sOrgName); |
| | | lw_obj.dw_user.SetItemString(nRow,"JobID",sJobID); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"JobID",sJobName); |
| | | |
| | | lw_obj.dw_user.SetItemString(nRow,"Status","Y"); |
| | | lw_obj.dw_user.SetItemDisplayString(nRow,"Status","ææ"); |
| | | string sdate = TApp::GetCurDate()+""; |
| | | lw_obj.dw_user.SetItemString(nRow,"StartDate",sdate+""); |
| | | lw_obj.dw_user.SetItemString(nRow,"EndDate","2050-12-31");*/ |
| | | |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | trace(row); |
| | | } |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnSubTree(string id,int parentitem) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | if (treeview__::GetChildItem(wid,parentitem) >0) return 1; |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid",id); |
| | | if(url::post("/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("//item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | string stype; |
| | | if (s >0) |
| | | { |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | sName = xitem.SelectSingleNode("name").text; |
| | | sguid = xitem.SelectSingleNode("id").text; |
| | | stype = xitem.SelectSingleNode("typ").text; |
| | | //int curItem = tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | int curItem=0; |
| | | if (stype =="Org") |
| | | { |
| | | curItem=tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,15,4); |
| | | tv_org.SetItemChild1(wid,curItem,1); |
| | | } |
| | | else |
| | | { |
| | | curItem=tv_org.InsertChildItemEx(wid,parentitem,sName,xitem,21,21); |
| | | } |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(string id,int parentitem) |
| | | { |
| | | //while (tv_1.GetRootItem()>0) |
| | | // tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | int wid = tv_org.GetId(); |
| | | xml__ x = new xml__; |
| | | x.setNativePointer(xml__ ::CreateInstance()); |
| | | x.LoadXml("<item><id>"+id+"</id><no/><name>å¤å°éå¢</name><typ>Org</typ></item>"); |
| | | //msxml::IXMLDOMDocument root = x.GetXmlDoc(); |
| | | //msxml::IXMLDOMElement RDoc = x.GetXmlDoc().documentElement; |
| | | //msxml::IXMLDOMElement ele = RDoc.SelectSingleNode("//Org"); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().SelectSingleNode("//item"); |
| | | int hItem = treeview__::InsertChildItemEx(wid,0,"å¤å°éå¢",ele,15,4); |
| | | treeview__::SetItemChild1(wid,hItem,1); |
| | | return 1; |
| | | |
| | | /*xaserverarg__ arg=new xaserverarg__; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sguid",id); |
| | | if(url::post("/sale/data/OrganizationStruct/tree.child.OrgChart",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXml()); |
| | | return -1; |
| | | } |
| | | //trace(x.GetXml()); |
| | | var list=x.GetXmlDoc().selectNodes("//item"); |
| | | int i=0,s=list.length; |
| | | msxml::IXMLDOMElement xitem; |
| | | string sName; |
| | | string sguid; |
| | | if (s >0) |
| | | { |
| | | for (i=0;i<s;i++) |
| | | { |
| | | xitem= list.item(i); |
| | | sName = xitem.SelectSingleNode("@name").text; |
| | | sguid = xitem.SelectSingleNode("@id").text; |
| | | int curItem = tv_org.InsertChildItemEx(wid,hItem,sName,xitem,15,4); |
| | | tv_org.SetItemChild1(wid,curItem,1); |
| | | //OnSubTree(sguid,curItem); |
| | | } |
| | | } |
| | | return 1;*/ |
| | | } |
| | | |
| | | int OnTreeExpanding(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int sitem = nmtv.itemNew.hItem; |
| | | |
| | | int hCursor = xutil__::SetCursorWait(); |
| | | //string id = treeview__::GetItemData(tv_org.GetId(), sitem); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(tv_org.GetId(),sitem); |
| | | string id = ele.SelectSingleNode("id").text; |
| | | OnSubTree(id, sitem); |
| | | xutil__::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TXCommandEvent evt,int p) |
| | | { |
| | | int wid = tv_org.GetId(); |
| | | int hitem=treeview__::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement ele = treeview__::GetItemData(wid,hitem); |
| | | if (ele) |
| | | { |
| | | string ls_orgid = ele.SelectSingleNode("id").text; |
| | | is_orgid = ls_orgid; |
| | | OnRetrieve(ls_orgid); |
| | | } |
| | | return 1; |
| | | } |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid=="cb_import") |
| | | OnOK(); |
| | | else if (comdid=="cb_close") |
| | | CloseWindow(); |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_org", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("tv_org", "TVN_ITEMEXPANDING",OnTreeExpanding); |
| | | } |
| | | |
| | | int OnInitial() |
| | | { |
| | | SetAgent(); |
| | | OnAttachEvent(); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | tv_org = new treeview__ ; |
| | | tv_org.setNativePointer(this.GetControl("tv_org")); |
| | | dw_list = new xdwgrid__; |
| | | dw_list.setNativePointer(this.GetControl("dw_list")); |
| | | dw_list.openUrl("ç³»ç»ç¨æ·.vface/template/SysUser/EmpSelect"); |
| | | dw_list.SetSelectionMode(3); //3 |
| | | dw_list.SetReadOnly(true); |
| | | |
| | | OnInitial(); |
| | | OnCreateTree("00000000-0000-0000-0000-000000000000", 0); |
| | | int wid = tv_org.GetId(); |
| | | int root = treeview__::GetRootItem(wid); |
| | | treeview__::ExpandItem(wid,root); |
| | | OnRetrieve("00000000-0000-0000-0000-000000000000"); |
| | | return 1; |
| | | } |
| | | ] |
| | | |
| | | ] |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class UserPassDlg : public xframe |
| | | { |
| | | //xdwgrid dw_list; |
| | | |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | static string MD5(string) native from "XUtil.dll" alias "?MD5@IXFUtil@XFrame@Hxsoft@@SAPA_WPA_W@Z"; |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmOk") |
| | | { |
| | | if(GetControl("old_pass").GetText()=="") |
| | | { |
| | | alert("请è¾å
¥æ§å£ä»¤!"); |
| | | win32::SetFocus(GetControl("old_pass").GetId()); |
| | | return 1; |
| | | } |
| | | |
| | | string ostr = GetControl("old_pass").GetText(); |
| | | string str1 = GetControl("new_pass").GetText(); |
| | | string str2 = GetControl("new_pass1").GetText(); |
| | | if(str1 != str2) |
| | | { |
| | | alert("䏤鿰å£ä»¤ä¸ä¸è´!"); |
| | | win32::SetFocus(GetControl("new_pass1").GetId()); |
| | | return 1; |
| | | } |
| | | |
| | | string oldpass = MD5(ostr); |
| | | string newpass = MD5(str1); |
| | | |
| | | xml x=new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("old_password",oldpass); |
| | | arg.AddArg("new_password",newpass); |
| | | |
| | | if(getUrl("/sale/data/SysUser/update/password",arg.GetString(),x)!=1) |
| | | { |
| | | alert("ä¿®æ¹å¤±è´¥"); |
| | | } |
| | | else{ |
| | | if(x.GetXmlDoc().selectSingleNode("error")) |
| | | { |
| | | alert(x.GetXmlDoc().selectSingleNode("error").text); |
| | | return 1; |
| | | } |
| | | win32::MessageBox(GetHWND(),"ä¿®æ¹å£ä»¤æåï¼","æç¤º",0); |
| | | CloseWindow(); |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | |
| | | //const int EM_SETPASSWORDCHAR =0x00CC; |
| | | //win32::SendMessage(GetControl("old_pass").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | //win32::SendMessage(GetControl("new_pass").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | //win32::SendMessage(GetControl("new_pass1").GetId(),EM_SETPASSWORDCHAR,42,0); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class levelCustomerv3 : public listwin |
| | | { |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | |
| | | string m_sType; //type |
| | | string m_sTypeTxt; //é䏿 çdata |
| | | // string m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | string m_agentCond; //Agent Node |
| | | |
| | | |
| | | int OnPreRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml ::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("pageindex", PIndex.toString()); //第å 页 |
| | | arg.AddArg("pagenumber", m_pageNumber.toString()); //æ¯é¡µæ°é |
| | | arg.AddArg("QueryTxt",m_QueryTxt ); |
| | | arg.AddArg("sType", m_sType);//没æåæ° |
| | | arg.AddArg("sTypeTxt", m_sTypeTxt);//没æåæ° |
| | | |
| | | if(getUrl("/sale/data/"+GetEntityName(1)+"/entity/list",arg.GetString(),x)!=1) |
| | | { |
| | | alert("åºç°é误请è系管çåï¼"); |
| | | return 0; |
| | | }else |
| | | { |
| | | msxml::IXMLDOMElement e=x.GetXmlDoc().documentElement; |
| | | if(listwin::dw_pages.ptr_native_ && e.selectSingleNode("@TotalPage")) |
| | | { |
| | | string s=e.selectSingleNode("@TotalPage").text; //æ»æ°é |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(ref TNotifyEvent evt,int p) |
| | | { |
| | | ref PAGENMHDR h = evt.pnmh; |
| | | int c = h.cur; |
| | | int hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex=c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | |
| | | int ViewUpdate(int pr,string updateItem,xaserverarg arg) |
| | | { |
| | | if(updateItem == "refresh") |
| | | { |
| | | xdwpages zz = this.GetControl("pages"); |
| | | int h = zz.SetCurPage(1); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //æ éæ© |
| | | int OnTreeSelChanged(ref TNotifyEvent evt,int p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | int wid = tv_1.GetId(); |
| | | int h=xtreeview::GetSelectedItem(wid); |
| | | msxml::IXMLDOMElement e = xtreeview::GetItemData(wid,h); |
| | | |
| | | string t = e.SelectSingleNode("@type").text; |
| | | m_sType=t+""; |
| | | string txt = e.SelectSingleNode("@code").text; |
| | | if (txt == "") |
| | | txt = e.SelectSingleNode("@name").text; |
| | | m_sTypeTxt= txt+""; |
| | | |
| | | PIndex= 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(int wid,int h, msxml::IXMLDOMElement ele) |
| | | { |
| | | msxml::IXMLDOMNodeList nlist=ele.SelectNodes("item"); |
| | | int i; |
| | | int s=nlist.length; |
| | | if (s>0) |
| | | for (i=0; i<s; i++) |
| | | { |
| | | msxml::IXMLDOMElement e=nlist.item(i); |
| | | string name=e.SelectSingleNode("@name").text; |
| | | int hw=xtreeview::InsertChildItem(wid,h,name,trust(e as int),15); |
| | | createSubTree(wid,hw, e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(string sType) |
| | | { |
| | | int wid = tv_1.GetId(); |
| | | while (xtreeview::GetRootItem(wid)>0) |
| | | xtreeview::DeleteItem(wid,xtreeview::GetRootItem(wid)); |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sType",sType); |
| | | if(getUrl("/sale/data/"+GetEntityName(1)+"/pref/list/tree",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | msxml::IXMLDOMNodeList nlist=x.GetXmlDoc().SelectNodes("root/item"); |
| | | int len = nlist.length; |
| | | if (len >0) |
| | | { |
| | | int i; |
| | | for (i=0;i <len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.SelectSingleNode("@name").text; |
| | | int h = xtreeview::InsertChildItem(wid,0,name,trust(e as int),15); |
| | | createSubTree(wid,h,e); |
| | | xtreeview::ExpandItem(wid,h); |
| | | } |
| | | xtreeview::ExpandItem(wid,0); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox䏿 |
| | | int OnSelectDdlb(ref TNotifyEvent evt,int p) |
| | | { |
| | | changeddlb=1; |
| | | int wid = ddlb_1.GetId(); |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = win32::SendMessage(wid,CB_GETCURSEL,0,0); |
| | | msxml::IXMLDOMElement e = ddlb_1.GetElement(); |
| | | msxml::IXMLDOMElement e2 = e.selectSingleNode("item["+(nIndex+1).toString()+"]"); |
| | | string text=e2.selectSingleNode("@element").text; |
| | | OnCreateTree(text); |
| | | changeddlb=0; |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1){ |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | msxml::IXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | string sguid = e.SelectSingleNode("@guid").text; |
| | | string sName = e.selectSingleNode("Name").text+""; |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if(win32::MessageBox(GetHWND(),"确认è¦å é¤å®¢æ· "+sName+" çä¿¡æ¯åï¼","æç¤º",MB_YESNO)!=IDYES) return 1; |
| | | xml x = new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid",sguid); |
| | | if (url::post("/sale/data/"+GetEntityName(1)+"/entity/delete",arg.GetString(),x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSelectAllRow() |
| | | { |
| | | int rows = listwin::dw_list.GetRowCount(); |
| | | if(rows < 1) return -1; |
| | | listwin::dw_list.SelectRow(1, rows, true); |
| | | listwin::dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnRClick(ref TNotifyEvent evt,int p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | //设置å±çº§å¼¹åºçªä¸ä¿å |
| | | int OnLevelCustomer() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | OpenWindow("dev:xpage[maint.Level.Customer3.vx]", cast(arg as int)); |
| | | |
| | | xml ux = new xml; |
| | | ux.setNativePointer(ux.CreateInstance()); |
| | | ux.LoadXml("<Partys/>"); |
| | | msxml::IXMLDOMElement ele = ux.GetXmlDoc().documentElement; |
| | | |
| | | if(arg.GetArgString("ok")=="true") |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | x.LoadXml(arg.GetArgString("arg")); |
| | | msxml::IXMLDOMElement uele = x.GetXmlDoc().documentElement; |
| | | string ParentPartyID = uele.selectSingleNode("//ParentPartyID").text; |
| | | string ParentPartyName = ""; |
| | | string GroupPartyID = uele.selectSingleNode("//GroupPartyID").text; |
| | | string GroupPartyName = ""; |
| | | |
| | | if( uele.selectSingleNode("//ParentPartyID/@_displaystring")) |
| | | ParentPartyName = uele.selectSingleNode("//ParentPartyID/@_displaystring").text; |
| | | if(uele.selectSingleNode("//GroupPartyID/@_displaystring")) |
| | | GroupPartyName = uele.selectSingleNode("//GroupPartyID/@_displaystring").text; |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | while(row > 0) |
| | | { |
| | | dw_list.SetItemString(row,"ParentPartyID",ParentPartyID); |
| | | dw_list.SetItemDisplayString(row,"ParentPartyID",ParentPartyName); |
| | | dw_list.SetItemString(row,"GroupPartyID",GroupPartyID); |
| | | dw_list.SetItemDisplayString(row,"GroupPartyID",GroupPartyName); |
| | | ele.appendChild(dw_list.GetRowElement(row).cloneNode(-1)); |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | dw_list.RedrawEx(); |
| | | arg.AddArg("content",ele.xml); |
| | | if (getUrl("/sale/data/CustomerV3/level/update",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | alert("设置é误!"); |
| | | return -1; |
| | | }else |
| | | { |
| | | alert("设置æå!"); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int PreOnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid.find("action:LogOff",0)>=0) return OnLogOff(); |
| | | if(comdid.find("action:bill.delete",0)>=0) return OnDeleteRow(); |
| | | //if(comdid=="action:search1") return GridSearch(); |
| | | if(comdid=="action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if(comdid=="action:level.customer") |
| | | { |
| | | return OnLevelCustomer(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(ref TNotifyEvent evt,int p) |
| | | { |
| | | alert("999"); |
| | | ref DWNMHDR hdr =cast(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | msxml::IXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | string entity = ele.selectSingleNode("CustomerID").text; |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("EntityID",entity); |
| | | if (getUrl("/sale/data/CustomerV3/entity/customeritem",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //è·å¾æ çéæ©äºä»¶ |
| | | AttachEvent("tv_1", "TVN_SELCHANGED",OnTreeSelChanged); |
| | | AttachEvent("cbx_1","CBN_SELCHANGE",OnSelectDdlb); |
| | | AttachEvent("pages","PAGE_CLICK",OnChangePages); |
| | | AttachEvent("dw_list","DWV_RCLICKED",OnRClick);//é¼ æ å³é® |
| | | //AttachEvent("dw_list","DWV_CLICKED",OnClick);//é¼ æ å³é® |
| | | AttachEvent("dw_list","DWV_ROWFOCUSCHANGED",OnRowChangedEx); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex=1; |
| | | listwin::m_QueryTxt =""; //æ¥è¯¢æ¡ä»¶ |
| | | m_sType=""; //type |
| | | m_sTypeTxt=""; //é䏿 çdata |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = this.GetControl("tv_1"); |
| | | ddlb_1 = this.GetControl("cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree("Source"); |
| | | dw_goods = GetControl("dw_goods"); |
| | | dw_goods.openUrl("/sale/view/CustomerV3/template/customer/customeritem"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | listwin::onloaded(); |
| | | |
| | | string EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if(row<0 || row>dw_list.GetRowCount()) return ""; |
| | | msxml::IXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | string id = listwin::m_configDoc.selectSingleNode("//entity/EntityID[1]").text; |
| | | if(ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text; |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | unit trade |
| | | [ |
| | | class MaintLevelCustomerWin : public xframe |
| | | { |
| | | xdwtable dw_arg; |
| | | xaserverarg arg; |
| | | |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmOk") |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(x.CreateInstance()); |
| | | dw_arg.AcceptText(); |
| | | dw_arg.DwUpdateAllTo(x.GetXmlDoc()); |
| | | if(arg) |
| | | { |
| | | arg.AddArg("arg",x.GetXml()); |
| | | arg.AddArg("ok","true"); |
| | | } |
| | | CloseWindow(); |
| | | |
| | | return 1; |
| | | } |
| | | else if(comdid=="xmCancel") |
| | | { |
| | | if(arg)arg.AddArg("ok","false"); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_arg = GetControl("dw_arg"); |
| | | |
| | | if(GetParam())arg = GetParam(); |
| | | |
| | | string dw = "/sale/view/CustomerV3/template/customer/level.maint"; |
| | | dw_arg.openUrl(dw); |
| | | |
| | | dw_arg.SetColHeaderHeight(0); |
| | | dw_arg.SetRowSelectorWidth(0); |
| | | dw_arg.SetHScrollState(false); |
| | | dw_arg.SetVScrollState(false); |
| | | |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | ] |
¶Ô±ÈÐÂÎļþ |
| | |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | use "datastore_bind.vd" |
| | | |
| | | |
| | | unit trade |
| | | [ |
| | | class AssignAdjustWin : public xframe |
| | | { |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | msxml::IXMLDOMElement rptEle; |
| | | string argStr; |
| | | string searchStr; |
| | | int hWndRetrieveTip; |
| | | bool dataretrieveing; |
| | | |
| | | int SetAgent() |
| | | { |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if(m_agentNode) |
| | | { |
| | | SetAgentNodeContent (anode,m_agentNode); |
| | | } |
| | | else |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/"+xfNodeAgentArea+"[1]/*"); |
| | | if(agent) |
| | | { |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent (anode,s); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | dw_list.AcceptText(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(xaserverarg::CreateInstance()); |
| | | |
| | | xml x0 = ViewObject::MakeXml(); |
| | | x0.LoadXml("<data/>"); |
| | | msxml::IXMLDOMNodeList t = x.GetXmlDoc().selectNodes("data/node()[(@update.new='1') or (@update.modify='1') or (@update.delete='1') ]"); |
| | | msxml::IXMLDOMElement e1= x0.GetXmlDoc().documentElement; |
| | | |
| | | string val0 = x.GetXml(); |
| | | for(int i=0; i < t.length; i++) |
| | | { |
| | | msxml::IXMLDOMElement e= t.item(i); |
| | | e1.appendChild(e); |
| | | } |
| | | |
| | | x = ViewObject::RetrieveData(rptEle.getAttribute("update"),"content",x0.GetXml()); |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if(str == "true") |
| | | { |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("ä¿åæå!"); |
| | | }else |
| | | { |
| | | alert("ä¿å失败!"); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //ç¦ç¹æ¿æ´»å¤ç彿° |
| | | int OnSetFocus(ref TEvent evt,int param) |
| | | { |
| | | //é置工å
·æ¡ |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnMultiDeal() |
| | | { |
| | | dw_list.AcceptText(); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | string SalespersonID = dw_list.GetItemString(row, "SalespersonID"); |
| | | string Sales = dw_list.GetItemDisplayString(row, "SalespersonID"); |
| | | while(row > 0 && row <= dw_list.GetRowCount()) |
| | | { |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | dw_list.SetItemString(row, "SalespersonID", SalespersonID); |
| | | dw_list.SetItemDisplayString(row, "SalespersonID", Sales); |
| | | |
| | | } |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | |
| | | int OnSearch() |
| | | { |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("text", searchStr); |
| | | OpenWindow("dev:xpage[search.dialog.vx]", cast(arg as int)); |
| | | string str = arg.GetArgString("text"); |
| | | if(str != searchStr) |
| | | { |
| | | searchStr = str; |
| | | dw_list.Filter("*",searchStr); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //å½ä»¤åå¸å½æ° |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if(comdid=="xmSave")return OnSave(); |
| | | if(comdid=="xmMultiDeal")return OnMultiDeal(); |
| | | if(comdid=="xmSearch") return OnSearch(); |
| | | if(comdid=="xmAnalysis") |
| | | { |
| | | //hCursor = xutil::SetCursorWait(); |
| | | string str = dw_list.DataAnalysis(""); |
| | | xaserverarg arg=new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("html", str); |
| | | int obj = cast(dw_list as int); |
| | | arg.AddArg("obj",obj.toString()); |
| | | OpenWindow("dev:xpage[data.vanalysis.vx]", cast(arg as int)); |
| | | //xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | } |
| | | if(comdid=="xmQuery") |
| | | { |
| | | if(rptEle) |
| | | { |
| | | string argUrl = rptEle.getAttribute("arg"); |
| | | if(argUrl !="") |
| | | { |
| | | xaserverarg ar = new xaserverarg; |
| | | ar.setNativePointer(ar.CreateInstance()); |
| | | ar.AddArg("argurl",argUrl); |
| | | if(argStr !="") |
| | | ar.AddArg("arg",argStr); |
| | | OpenWindow("dev:xpage[view.total.arg.vx]",cast(ar as int)); |
| | | string arstr = ar.GetArgString("arg"); |
| | | if(arstr != "" && ar.GetArgString("action")=="ok") |
| | | { |
| | | argStr = arstr; |
| | | OnRetrieve(rptEle.getAttribute("data"),argStr); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | argStr=""; |
| | | OnRetrieve(rptEle.getAttribute("data"),argStr); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | //å½ä»¤å¤çäºä»¶ |
| | | int OnXCommand(ref TXCommandEvent evt,int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //ç»å®å·¥å
·æ¡ç¹å»äºä»¶ |
| | | AttachEvent("WM_XCOMMAND",OnXCommand); |
| | | //è·åç¦ç¹äºä»¶ï¼ç¨äºé置工å
·æ¡ |
| | | AttachEvent("WM_SETFOCUS",OnSetFocus); |
| | | |
| | | AttachEvent("cb_report","CBN_SELCHANGE",OnCombboChanged); |
| | | } |
| | | |
| | | int OnCombboChanged(ref TCommandEvent evt,int lParam) |
| | | { |
| | | int h = xcombobox::GetCurSel(evt.hCtrl); |
| | | if(h > -1) ShowList(h); |
| | | return 1; |
| | | } |
| | | |
| | | int SwitchReport(msxml::IXMLDOMElement e) |
| | | { |
| | | rptEle = e; |
| | | string dwname = e.getAttribute("template"); |
| | | dw_list.openUrl(dwname); |
| | | dw_list.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int ShowList(int h) |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement e = xframeElement.selectSingleNode("//xcombobox[@name='cb_report']/item["+(h+1).toString()+"]"); |
| | | if(e) SwitchReport(e); |
| | | win32::PostMessage(GetHWND(),0x401,"xmQuery",0); |
| | | return 1; |
| | | } |
| | | |
| | | int ShowRetrieveingTip() |
| | | { |
| | | dataretrieveing = true; |
| | | xwin pwin = OpenWindow("dev:xpage[TestRetrieveing.vx]",0); |
| | | hWndRetrieveTip =pwin.GetHWND(); |
| | | return 1; |
| | | } |
| | | int CloseRetrieveTip() |
| | | { |
| | | dataretrieveing = false; |
| | | win32::SendMessage(hWndRetrieveTip,0x401,"RetrieveFinished",0); |
| | | hWndRetrieveTip = 0; |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string dataurl, string argstr) |
| | | { |
| | | if(!rptEle) return 0; |
| | | dw_list.Reset(); |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("arg",argstr); |
| | | if (url::get(dataurl,arg.GetString(),x)!=1) |
| | | { |
| | | |
| | | trace("é误信æ¯="+x.GetXmlDoc().text); |
| | | dw_list.Redraw(); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetSelectionMode(4); |
| | | //dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | rptEle = 0; |
| | | dw_list = GetControl("dw_list"); |
| | | OnAttachEvent(); |
| | | |
| | | hWndRetrieveTip = 0; |
| | | dataretrieveing = false; |
| | | ShowList(0); |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |