From 7a91c3a1ed37b0332d4ff0ebeae60bd6da3665c0 Mon Sep 17 00:00:00 2001 From: xj qian <qianxj15@sina.com> Date: 星期二, 16 七月 2024 18:28:58 +0800 Subject: [PATCH] Merge branch 'master' of http://116.62.18.175:6699/r/mis-prj --- jrj/project/business/BasicCode/SKUItem.select.cpp | 126 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 126 insertions(+), 0 deletions(-) diff --git a/jrj/project/business/BasicCode/SKUItem.select.cpp b/jrj/project/business/BasicCode/SKUItem.select.cpp new file mode 100644 index 0000000..82f820b --- /dev/null +++ b/jrj/project/business/BasicCode/SKUItem.select.cpp @@ -0,0 +1,126 @@ +use "dev:code[SKUItem.vx]" + +unit vbusiness.vpage +[ + SKUItemImport is extend SKUItem; + about SKUItemImport + [ + field: + xdwgrid dw_list; + treeview tv_1; + xdwtable dw_maint; + method: + [ + + xstring jxParam(xstring p, xstring n) + { + if(p != L"") + { + + int i = 1; + while (p.find(L"=L",0)>0) + { + xstring name = p.mid(0, p.find(L"=L",0)); + xstring value = p.mid(p.find(L"=L",0) + 1, p.find(L"=L",0) - 1); + return ""+value; + i += 1; + } + } + return ""; + } + 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() + { + + xdwtable dw = new xdwtable; + dw.setNativePointer(dw_maint.FindDwTable(L"Item",0)); + + int row = SKUItem::dw_list.GetNextSelectRow(1); + if (row<1) + { + alert(L"请选择项目名称!"); + return 1; + } + + while (row>0) + { + + msxml::IXMLDOMElement e =SKUItem::dw_list.GetRowElement(row); + xstring ItemName = e.selectSingleNode(L"ItemName").text+L""; + //trace(ItemName); + if(dw.GetItemString(1,L"ItemName")==L"") + { + dw.SetItemString(1,L"SeqNo",L"1"); + dw.ItemChangeTo(1,L"ItemName",ItemName); + } + else + { + int n=dw.InsertRow(0); + dw.SetItemString(n,L"SeqNo",n.ToString()); + dw.ItemChangeTo(n,L"ItemName",ItemName); + } + row = SKUItem::dw_list.GetNextSelectRow(row +1); + } + CloseWindow(); + return 1; + } + + int OnCancel() + { + CloseWindow(); + return 1; + } + int OnDoubleClicked(ref TNotifyEvent evt,int p) + { + OnOk(); + return 1; + } + + int OnCmdDispatch(xstring comdid) + { + if (comdid==L"SelectAll") OnSelectAll(); + else if (comdid==L"SelectNo") OnSelectNo(); + else if (comdid==L"cb_import") OnOk(); + else if (comdid==L"cb_close") OnCancel(); + //else if (comdid==L"query") GridSearch(); + return 0; + } + + int OnXCommand(ref TXCommandEvent evt,int p) + { + return OnCmdDispatch(evt.pStrID); + } + + int onload() + { + if (GetParam()) + { + xaserverarg arg1=GetParam(); + dw_maint = new xdwtable; + dw_maint.setNativePointer(arg1.GetArgString(L"dw_maint").toInt()); + } + SKUItem::onload(); + SKUItem::dw_list.SetSelectionMode(3); //3 + SKUItem::dw_list.SetReadOnly(true); + AttachEvent(L"WM_XCOMMAND",OnXCommand); + AttachEvent(L"dw_list",L"DWV_DOUBLECLICKED",OnDoubleClicked);//行双击 + } + ] + ] +] \ No newline at end of file -- Gitblit v1.9.3