| | |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\EnquiryEx3.list.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\Enquiry.maint.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\EnquiryEx.quote.vx.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\Entity.Product.Select.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\PriceList.PurcharItemSelect.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\PriceList.PurcharItemSelectEx.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\ProductSchema.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\ProductSchemaSelect.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\QuoteFile.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\SKU.PictureView.Product3.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\ViewPictures.cpp" /> |
| | | <ClCompile Include="..\project\business\Enquiry\Enquiry.maint.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\EnquiryEx.quote.vx.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\Entity.Product.Select.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\PriceList.PurcharItemSelect.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\PriceList.PurcharItemSelectEx.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\ProductSchema.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\ProductSchemaSelect.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\SKU.PictureView.Product3.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Enquiry\ViewPictures.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Expense\BasicFare.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | |
| | | <ClCompile Include="..\project\business\Public\UserGroupShareEx.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\quote.enquiry.cpp"> |
| | | <ClCompile Include="..\project\business\QuoteFile.cpp"> |
| | | <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</ExcludedFromBuild> |
| | | </ClCompile> |
| | | <ClCompile Include="..\project\business\Quote3.list3.cpp"> |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "enquiry.view.vd" |
| | | use "quote.view.vd" |
| | | use "publiccode.vutil.vbusiness.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class EnquiryMaintView : public frame |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | xdwgrid dw_goods; |
| | | xdwtable dw_base; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | xnode m_agentNode; //Agent Condition |
| | | string sheetname; |
| | | |
| | | int SetAgent() |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | string GetEntityData(int pr) |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_goods.AcceptText(); |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | { |
| | | string EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, "EnquiryNo", EnquiryNo); |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_goods.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | return x.GetXml(); |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | int SetSeqNo(xdwgrid dw_obj, string SeqNoColumn, int nRow) |
| | | { |
| | | if (nRow > 1) |
| | | { |
| | | int SeqNo = dw_goods.GetItemInt(nRow - 1, SeqNoColumn); |
| | | if (SeqNo != 0) SeqNo += 10; else SeqNo = nRow * 10; |
| | | dw_obj.SetItemInt(nRow, SeqNoColumn, SeqNo); |
| | | } |
| | | else |
| | | dw_obj.SetItemInt(nRow, SeqNoColumn, 10); |
| | | return 1; |
| | | } |
| | | |
| | | int Adjust() |
| | | { |
| | | string str; |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | str = dw_goods.GetItemString(i, "SupplierID"); |
| | | if (dw_goods.GetItemString(i, "ItemID") != "") |
| | | if (str == "") |
| | | { |
| | | if (i > 1) |
| | | { |
| | | if (dw_goods.GetItemString(i - 1, "SupplierID") != "") |
| | | { |
| | | dw_goods.SetItemDisplayString(i, "SupplierID", dw_goods.GetItemDisplayString(i - 1, "SupplierID")); |
| | | dw_goods.ItemChangeTo(i, "SupplierID", dw_goods.GetItemString(i - 1, "SupplierID")); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_goods.AcceptText(); |
| | | if (dw_base.GetItemString(1, "Remark") != "保存") |
| | | { |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | { |
| | | string EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, "EnquiryNo", EnquiryNo); |
| | | } |
| | | |
| | | if (dw_base.GetItemString(1, "ValidDay") == "") |
| | | { |
| | | alert("请输入有效期!"); |
| | | return 1; |
| | | } |
| | | /*if(dw_base.GetItemString(1,"SupplierID")=="") |
| | | { |
| | | alert("供应商为空!"); |
| | | return 1; |
| | | }*/ |
| | | if (dw_base.GetItemString(1, "Source") == "") |
| | | { |
| | | alert("请输入询价类别!"); |
| | | return 1; |
| | | } |
| | | string Packing = ""; |
| | | string Packings = ""; |
| | | Adjust(); |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | if (dw_goods.GetItemString(i, "ItemMiniQty") == "") |
| | | { |
| | | alert("请输入起订量!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "Picture") == "") |
| | | { |
| | | alert("请 " + i.toString() + "行,上传产品图片!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "POPrice") == "" || dw_goods.GetItemString(i, "POPrice") == ".000") |
| | | { |
| | | alert("请输入采购价!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "PriceType") == "") |
| | | { |
| | | alert("请输入价格类型!"); |
| | | return 1; |
| | | } |
| | | |
| | | if (dw_goods.GetItemString(i, "SampleFee") == "") |
| | | { |
| | | alert("请输入打样费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "TestFee") == "") |
| | | { |
| | | alert("请输入测试费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "ModelFee") == "") |
| | | { |
| | | alert("请输入模具费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "VolumeDesc") == "") |
| | | { |
| | | alert("请输入包装尺码!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "WarehousingReason") == "") |
| | | { |
| | | alert("请输入入库理由!"); |
| | | return 1; |
| | | } |
| | | |
| | | /*if(dw_goods.GetItemString(i,"Packing") !="") |
| | | { |
| | | Packing = dw_goods.GetItemString(i,"Packing"); |
| | | if(Packings=="") |
| | | Packings = Packing; |
| | | else if(Packings.find(Packing) < 0) Packings+=","+Packing; |
| | | }*/ |
| | | if (dw_goods.GetItemString(i, "Packing") == "") |
| | | { |
| | | alert("请输包装方式!"); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | xml xx = ViewObject::RetrieveData("/sale/data/Enquiry/GetPacking", "str", dw_goods.GetItemString(i, "Packing")); |
| | | string Results = xx.GetXmlDoc().text; |
| | | int ResultsInt = Results.toInt(); |
| | | if (ResultsInt == 0) |
| | | { |
| | | alert("第" + i.toString() + "行包装方式错误,请重新选择!"); |
| | | return 1; |
| | | } |
| | | } |
| | | } |
| | | trace("********" + Packings + "*********"); |
| | | } |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_goods.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | |
| | | //alert(x.GetXml()); |
| | | |
| | | string error = ""; |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/Enquiry/update", arg.GetString(), x) != 1) |
| | | { |
| | | error = x.GetXmlDoc().text; |
| | | alert(error); |
| | | } |
| | | else |
| | | { |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if (str == "true") |
| | | { |
| | | dw_goods.ResetUpdateStatus(); |
| | | dw_base.ResetUpdateStatus(); |
| | | UpdateEnquiryLineID(); |
| | | |
| | | xaserverarg arg_ = new xaserverarg; |
| | | arg_.setNativePointer(GetParam()); |
| | | //trace("\r\nSource:"+arg_.GetArgString("Source")); |
| | | if (arg_.GetArgString("Source") == "quote") |
| | | InsertEnquiryPriceList(); |
| | | else if (arg_.GetArgString("Source") == "pricebill") |
| | | InsertEnquiryPriceListByEnquiryID(); |
| | | |
| | | alert("保存成功!"); |
| | | int hWnd = 0; |
| | | if (arg_.GetArgString("Source") == "pricebill") |
| | | { |
| | | if (arg_.GetArgString("hWnd") != "") |
| | | { |
| | | hWnd = arg_.GetArgString("hWnd").toInt(); |
| | | win32::PostMessage(hWnd, 0x401, "xmRefresh", 0); |
| | | } |
| | | } |
| | | if (arg_.GetArgString("Source") == "") |
| | | { |
| | | if (arg_.GetArgString("hWnd") != "") |
| | | { |
| | | hWnd = arg_.GetArgString("hWnd").toInt(); |
| | | win32::PostMessage(hWnd, 0x401, "xmReresh", 0); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | alert("保存失败!"); |
| | | } |
| | | } |
| | | if (x) x.Free(); |
| | | return 1; |
| | | } |
| | | |
| | | int InsertEnquiryPriceListByEnquiryID() |
| | | { |
| | | //trace("\r\nInsertEnquiryPriceListByEnquiryID Start!"); |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/InsertEnquiryPriceListByEnquiryID", "EnquiryID", dw_base.GetGuid(1)); |
| | | //trace("\r\nInsertEnquiryPriceListByEnquiryID:" + dw_base.GetGuid(1)+" "+ x.GetXml()); |
| | | return 1; |
| | | } |
| | | |
| | | int InsertEnquiryPriceList() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(GetParam()); |
| | | string EntityIDList = arg.GetArgString("EntityIDList"); |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/InsertEnquiryPriceList", "ItemList", EntityIDList); |
| | | xml x1 = ViewObject::RetrieveData("/sale/data/Enquiry/Update/UpdateQuoteLine", "ItemList", EntityIDList); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int UpdateEnquiryLineID() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | int row = dw_base.GetRow(); |
| | | if (row < 1) return 0; |
| | | |
| | | string EnquiryID = dw_base.GetGuid(1); |
| | | |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/Update/UpdateEnquiryLineID", "EnquiryID", EnquiryID); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave1() |
| | | { |
| | | dw_base.AcceptText(); |
| | | dw_goods.AcceptText(); |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | { |
| | | string EnquiryNo = EnquiryView::MakeBillNo(); |
| | | dw_base.SetItemString(1, "EnquiryNo", EnquiryNo); |
| | | } |
| | | |
| | | if (dw_base.GetItemString(1, "ValidDay") == "") |
| | | { |
| | | alert("请输入有效期!"); |
| | | return 1; |
| | | } |
| | | |
| | | if (dw_base.GetItemString(1, "Source") == "") |
| | | { |
| | | alert("请输入询价类别!"); |
| | | return 1; |
| | | } |
| | | string Packing = ""; |
| | | string Packings = ""; |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | if (dw_goods.GetItemString(i, "ItemMiniQty") == "") |
| | | { |
| | | alert("请输入起订量!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "Picture") == "") |
| | | { |
| | | alert("请 " + i.toString() + "行,上传产品图片!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "POPrice") == "" || dw_goods.GetItemString(i, "POPrice") == ".000") |
| | | { |
| | | alert("请输入采购价!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "PriceType") == "") |
| | | { |
| | | alert("请输入价格类型!"); |
| | | return 1; |
| | | } |
| | | |
| | | if (dw_goods.GetItemString(i, "SampleFee") == "") |
| | | { |
| | | alert("请输入打样费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "TestFee") == "") |
| | | { |
| | | alert("请输入测试费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "ModelFee") == "") |
| | | { |
| | | alert("请输入模具费!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "VolumeDesc") == "") |
| | | { |
| | | alert("请输入包装尺码!"); |
| | | return 1; |
| | | } |
| | | if (dw_goods.GetItemString(i, "WarehousingReason") == "") |
| | | { |
| | | alert("请输入入库理由!"); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | if (dw_goods.GetItemString(i, "Packing") != "") |
| | | { |
| | | Packing = dw_goods.GetItemString(i, "Packing"); |
| | | if (Packings == "") |
| | | Packings = Packing; |
| | | else if (Packings.find(Packing) < 0) Packings += "," + Packing; |
| | | } |
| | | } |
| | | |
| | | trace("********" + Packings + "*********"); |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | dw_base.DwUpdateAllTo(x.GetXmlDoc()); |
| | | msxml::IXMLDOMElement ele = x.GetXmlDoc().documentElement; |
| | | |
| | | xml x1 = xml::Make(); |
| | | dw_goods.DwUpdateAllToEx(x1.GetXmlDoc()); |
| | | msxml::IXMLDOMNodeList items = x1.GetXmlDoc().selectNodes("Enquiry/Item"); |
| | | int len = items.length; |
| | | bool processed = false; |
| | | msxml::IXMLDOMNode child; |
| | | msxml::IXMLDOMNode nodeColumn; |
| | | msxml::IXMLDOMElement eleItem; |
| | | msxml::IXMLDOMElement eleColumn; |
| | | string guid; |
| | | for (int k = 0; k < len; k++) |
| | | { |
| | | msxml::IXMLDOMElement e = items.item(k); |
| | | /*processed = false; |
| | | msxml::IXMLDOMNode col = e.selectSingleNode("QuoteNo"); |
| | | if(col) |
| | | { |
| | | if(col.text !="") |
| | | { |
| | | child = e.cloneNode(-1); |
| | | ele.appendChild(child); |
| | | child.release(); |
| | | processed = true; |
| | | } |
| | | col.release(); |
| | | } |
| | | if(!processed) |
| | | {*/ |
| | | string itemNew = e.getAttribute("update.new"); |
| | | string itemDelete = e.getAttribute("update.delete"); |
| | | string itemModify = e.getAttribute("update.modify"); |
| | | if (itemDelete == "1") |
| | | { |
| | | eleItem = x.GetXmlDoc().createElement("Item"); |
| | | eleItem.setAttribute("update.modify", "1"); |
| | | guid = e.getAttribute("guid"); |
| | | eleItem.setAttribute("guid", guid); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("LineType"); |
| | | eleColumn.setAttribute("update.modify", "1"); //delete |
| | | eleColumn.text = "1"; |
| | | eleItem.appendChild(eleColumn); |
| | | ele.appendChild(eleItem); |
| | | eleColumn.release(); |
| | | eleItem.release(); |
| | | processed = true; |
| | | } |
| | | else if (itemModify == "1") |
| | | { |
| | | if (itemNew != "1") |
| | | { |
| | | //update origin row |
| | | eleItem = x.GetXmlDoc().createElement("Item"); |
| | | eleItem.setAttribute("update.modify", "1"); |
| | | guid = e.getAttribute("guid"); |
| | | eleItem.setAttribute("guid", guid); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("RealEnquiryLineID"); |
| | | eleColumn.setAttribute("update.modify", "1"); |
| | | guid = publiccode::GetGuid(); |
| | | eleColumn.text = guid; |
| | | eleItem.appendChild(eleColumn); |
| | | eleColumn.release(); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("LineType"); |
| | | eleColumn.setAttribute("update.modify", "1"); |
| | | eleColumn.text = "1"; //modify |
| | | eleItem.appendChild(eleColumn); |
| | | ele.appendChild(eleItem); |
| | | eleColumn.release(); |
| | | eleItem.release(); |
| | | |
| | | //insert new row |
| | | eleItem = e.cloneNode(-1); |
| | | eleItem.setAttribute("update.modify", "1"); |
| | | eleItem.setAttribute("update.new", "1"); |
| | | eleItem.setAttribute("guid", publiccode::GetGuid()); |
| | | |
| | | eleColumn = x.GetXmlDoc().createElement("LineType"); |
| | | eleColumn.setAttribute("update.modify", "1"); |
| | | eleColumn.text = "0"; //normal |
| | | eleItem.appendChild(eleColumn); |
| | | eleColumn.release(); |
| | | |
| | | nodeColumn = e.selectSingleNode("ModifyDate"); |
| | | if (!nodeColumn) |
| | | eleColumn = x.GetXmlDoc().createElement("ModifyDate"); |
| | | else |
| | | eleColumn = nodeColumn; |
| | | eleColumn.text = publiccode::GetCurrentDate(); |
| | | eleItem.appendChild(eleColumn); |
| | | eleColumn.release(); |
| | | |
| | | ele.appendChild(eleItem); |
| | | eleItem.release(); |
| | | } |
| | | else |
| | | { |
| | | guid = e.getAttribute("guid"); |
| | | child = e.cloneNode(-1); |
| | | child.selectSingleNode("RealEnquiryLineID").text = guid; |
| | | child.selectSingleNode("RelEnquiryLineID").text = guid; |
| | | ele.appendChild(child); |
| | | //trace(child.xml); |
| | | child.release(); |
| | | } |
| | | } |
| | | //} |
| | | e.release(); |
| | | } |
| | | x1.Free(); |
| | | string error = ""; |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/Enquiry/update", arg.GetString(), x) != 1) |
| | | { |
| | | error = x.GetXmlDoc().text; |
| | | alert(error); |
| | | } |
| | | else |
| | | { |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | if (str == "true") |
| | | { |
| | | alert("保存成功!"); |
| | | //dw_goods.ResetUpdateStatus(); |
| | | //dw_base.ResetUpdateStatus(); |
| | | OnRetrieve(dw_base.GetItemString(1, "EnquiryNo")); |
| | | } |
| | | else |
| | | { |
| | | alert("保存失败!"); |
| | | } |
| | | } |
| | | if (x) x.Free(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int ImportProductByText(string str) |
| | | { |
| | | string CustomerID = dw_base.GetItemString(1, "CustomerID"); |
| | | //trace("Customer:"+CustomerID); |
| | | xml x; |
| | | if (CustomerID == "") |
| | | x = QuoteView::LookupProductsByText(str); |
| | | else |
| | | x = QuoteView::LookupProductsByText(str, CustomerID); |
| | | |
| | | if (!x) return 1; |
| | | msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("/Items/Item"); |
| | | trace("********" + x.GetXml() + "********"); |
| | | int len = items.length; |
| | | if (str.find(" ") < 0 && len > 0) len = 1; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = items.item(i); |
| | | dw_goods.InsertRow(0); |
| | | int nRow = dw_goods.GetRowCount(); |
| | | SetSeqNo(dw_goods, "SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, "UOMCode", "007"); |
| | | dw_goods.SetItemDisplayString(nRow, "UOMCode", "PCS"); |
| | | dw_goods.SetItemString(nRow, "KOPCode", "120"); |
| | | dw_goods.SetItemDisplayString(nRow, "KOPCode", "CTNS"); |
| | | dw_goods.SetItemString(nRow, "SKUNo", e.getAttribute("SKUNo")); |
| | | dw_goods.SetItemString(nRow, "ItemID", e.getAttribute("SKUID")); |
| | | //dw_goods.SetItemString(nRow,"ItemName",e.getAttribute("EName")); |
| | | dw_goods.SetItemString(nRow, "ItemName", e.getAttribute("CName")); |
| | | dw_goods.SetItemString(nRow, "GoodsNo", e.getAttribute("GoodsNo")); |
| | | dw_goods.SetItemString(nRow, "CustomerItemNo", e.getAttribute("CustomerItemNo")); |
| | | dw_goods.SetItemString(nRow, "Packing", e.getAttribute("Packing")); |
| | | dw_goods.SetItemString(nRow, "VolumeDesc", e.getAttribute("VolumeDesc")); |
| | | dw_goods.SetItemString(nRow, "PackingRate", e.getAttribute("QtyPerPkg")); |
| | | dw_goods.SetItemString(nRow, "InnerQty", e.getAttribute("InnerQty")); |
| | | dw_goods.SetItemString(nRow, "VATRefundRate", e.getAttribute("VATRefundRate")); |
| | | dw_goods.SetItemString(nRow, "VATRate", e.getAttribute("VATRate")); |
| | | dw_goods.SetItemString(nRow, "HSCode", e.getAttribute("HSCode")); |
| | | //trace("+++++"+e.getAttribute("Picture")+"+++++"); |
| | | dw_goods.SetItemString(nRow, "Picture", e.getAttribute("Picture")); |
| | | |
| | | if (dw_goods.GetItemString(nRow, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(nRow, "Packages") != "") |
| | | { |
| | | int qty = EvalQtyPerFCL45H(nRow); |
| | | dw_goods.SetItemString(nRow, "Packages45H", qty.toString()); |
| | | dw_goods.SetItemDouble(nRow, "TransportationFee", 5000.0 / qty); |
| | | } |
| | | /* |
| | | dw_goods.SetItemString(nRow,"NwPerPkg",e.getAttribute("NwPerPkg")); |
| | | dw_goods.SetItemString(nRow,"GwPerPkg",e.getAttribute("GwPerPkg")); |
| | | dw_goods.SetItemString(nRow,"QTYPerPk",e.getAttribute("QTYPerPk")); |
| | | dw_goods.SetItemString(nRow,"InnerQty",e.getAttribute("InnerQty")); |
| | | */ |
| | | } |
| | | |
| | | int row = dw_goods.GetRow(); |
| | | if (row >= 1) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(row, "SKUNo"); |
| | | OnShowImage(skuno, row); |
| | | im.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | double EvalCost(int row) |
| | | { |
| | | double cost = 0.0; |
| | | cost += dw_goods.GetItemDouble(row, "POPrice"); |
| | | cost += dw_goods.GetItemDouble(row, "PaperCardPrice"); |
| | | cost += dw_goods.GetItemDouble(row, "TransportationFee"); |
| | | cost += dw_goods.GetItemDouble(row, "OtherFee"); |
| | | cost += dw_goods.GetItemDouble(row, "ManagementFee"); |
| | | return cost; |
| | | } |
| | | |
| | | double EvalRefund(int row) |
| | | { |
| | | double VATRefundRate = dw_goods.GetItemDouble(row, "VATRefundRate"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, "POPrice") * VATRefundRate / 117.0; |
| | | VATRefund += dw_goods.GetItemDouble(row, "PaperCardPrice") * 13.0 / 117.0; |
| | | return VATRefund; |
| | | } |
| | | |
| | | int EvalQtyPerFCL45H(int row) |
| | | { |
| | | double vol = EvalVol(dw_goods.GetItemString(row, "VolumeDesc")); |
| | | double packages = dw_goods.GetItemDouble(row, "Packages"); |
| | | return (packages * 67.0 / vol).toInt(); |
| | | } |
| | | double EvalUnitProfit(int row) |
| | | { |
| | | double ExchangeRate = dw_base.GetItemDouble(1, "ExchangeRate"); |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, "FobUnitPrice"); |
| | | double UnitCost = dw_goods.GetItemDouble(row, "UnitCost"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, "VATRefund"); |
| | | return ExchangeRate * FobUnitPrice - UnitCost + VATRefund; |
| | | } |
| | | |
| | | double EvalProfitRate(int row) |
| | | { |
| | | double UnitProfit = EvalUnitProfit(row); |
| | | double UnitCost = dw_goods.GetItemDouble(row, "UnitCost"); |
| | | return UnitProfit / UnitCost; |
| | | } |
| | | double EvalSaleProfitRate(int row) |
| | | { |
| | | double UnitProfit = EvalUnitProfit(row); |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, "FobUnitPrice"); |
| | | return UnitProfit / FobUnitPrice; |
| | | } |
| | | |
| | | double EvalExchangeCostRate(int row) |
| | | { |
| | | double FobUnitPrice = dw_goods.GetItemDouble(row, "FobUnitPrice"); |
| | | double UnitCost = dw_goods.GetItemDouble(row, "UnitCost"); |
| | | double VATRefund = dw_goods.GetItemDouble(row, "VATRefund"); |
| | | return (UnitCost - VATRefund) / FobUnitPrice; |
| | | } |
| | | |
| | | double EvalTransportationFee(int row) |
| | | { |
| | | double vol = EvalVol(dw_goods.GetItemString(row, "VolumeDesc")); |
| | | double packages = dw_goods.GetItemDouble(row, "Packages"); |
| | | return 80 * vol / packages; |
| | | } |
| | | |
| | | double EvalVol(string value) |
| | | { |
| | | double vol = 1.0; |
| | | string volstr = value; |
| | | int pos1 = volstr.find("*"); |
| | | int pos2 = volstr.find("X"); |
| | | int pos3 = volstr.find("x"); |
| | | int pos = pos1; |
| | | //trace("pos: "+ pos.toString() + "pos1: "+ pos1.toString() + "pos2: "+ pos2.toString() +"pos3: "+ pos3.toString()); |
| | | if (pos2 > 0 && pos == -1) pos = pos2; |
| | | if (pos2 >= 0 && pos2 < pos) pos = pos2; |
| | | //trace("pos: "+ pos.toString() + "pos1: "+ pos1.toString() + "pos2: "+ pos2.toString() +"pos3: "+ pos3.toString()); |
| | | if (pos3 > 0 && pos == -1) pos = pos3; |
| | | if (pos3 >= 0 && pos3 < pos) pos = pos3; |
| | | //trace("pos: "+ pos.toString() + "pos1: "+ pos1.toString() + "pos2: "+ pos2.toString() +"pos3: "+ pos3.toString()); |
| | | while (pos >= 0) |
| | | { |
| | | string tm = volstr.left(pos); |
| | | volstr = volstr.mid(pos + 1, 9999); |
| | | vol *= tm.toDouble(); |
| | | |
| | | pos1 = volstr.find("*"); |
| | | pos2 = volstr.find("X"); |
| | | pos3 = volstr.find("x"); |
| | | pos = pos1; |
| | | if (pos2 > 0 && pos == -1) pos = pos2; |
| | | if (pos2 >= 0 && pos2 < pos) pos = pos2; |
| | | if (pos3 > 0 && pos == -1) pos = pos3; |
| | | if (pos3 >= 0 && pos3 < pos) pos = pos3; |
| | | } |
| | | if (volstr != "") vol *= volstr.toDouble(); |
| | | return vol / 1000000.0; |
| | | } |
| | | |
| | | int OnShare() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("EntityID", dw_base.GetGuid(1)); |
| | | //arg.AddArg("EntityName", GetEntityName(0)); |
| | | arg.AddArg("EntityName", "Enquiry3"); |
| | | |
| | | OpenWindow("dev:xpage[UserGroupShare.vx]", cast(arg as int)); |
| | | return 1; |
| | | } |
| | | |
| | | int OnItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname = hdr.colname; |
| | | string value = hdr.data; |
| | | int row = hdr.row; |
| | | |
| | | double VATRefund = 0.0; |
| | | double VATRefundRate = 0.0; |
| | | if ((colname == "GoodsNo" || colname == "CustomerItemNo") && value != "") |
| | | { |
| | | if (colname == "CustomerItemNo") |
| | | { |
| | | if (dw_goods.GetItemString(row, "GoodsNo") != "") return 1; |
| | | } |
| | | xml x; |
| | | string CustomerID = dw_base.GetItemString(1, "CustomerID"); |
| | | string sval = value; |
| | | if (colname == "GoodsNo") |
| | | { |
| | | if (CustomerID != "") |
| | | sval = "gs:" + value; |
| | | else |
| | | sval = value; |
| | | } |
| | | if (colname == "CustomerItemNo") |
| | | /*sval="cs:"+value; |
| | | if(CustomerID !="") |
| | | x = QuoteView::LookupProductsByText(sval,CustomerID ); |
| | | else |
| | | x = QuoteView::LookupProductsByText(sval);*/ |
| | | sval = value; |
| | | x = ViewObject::RetrieveData("/sale/data/Quote/LookGDN", "str", sval); |
| | | if (!x) return 1; |
| | | msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("/Items/Item"); |
| | | trace(x.GetXml()); |
| | | int len = items.length; |
| | | if (len == 0) |
| | | { |
| | | if (colname == "GoodsNo") |
| | | { |
| | | alert("没有此公司型号!"); |
| | | dw_goods.SetItemString(dw_goods.GetRow(), "GoodsNo", ""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (len >= 1) |
| | | { |
| | | msxml::IXMLDOMElement e = items.item(0); |
| | | int nRow = dw_goods.GetRow(); |
| | | dw_goods.SetItemString(nRow, "SKUNo", e.getAttribute("SKUNo")); |
| | | dw_goods.SetItemString(nRow, "ItemID", e.getAttribute("SKUID")); |
| | | dw_goods.SetItemString(nRow, "ItemName", e.getAttribute("CName")); |
| | | if (colname == "CustomerItemNo")dw_goods.SetItemString(nRow, "GoodsNo", e.getAttribute("GoodsNo")); |
| | | if (colname == "GoodsNo")dw_goods.SetItemString(nRow, "CustomerItemNo", e.getAttribute("CustomerItemNo")); |
| | | dw_goods.SetItemString(nRow, "Packing", e.getAttribute("Packing")); |
| | | dw_goods.SetItemString(nRow, "InnerQty", e.getAttribute("InnerQty")); |
| | | dw_goods.SetItemString(nRow, "PackingRate", e.getAttribute("PackingRate")); |
| | | dw_goods.SetItemString(nRow, "VolumeDesc", e.getAttribute("VolumeDesc")); |
| | | dw_goods.SetItemString(nRow, "Packages", e.getAttribute("QTYPerPkg")); |
| | | dw_goods.SetItemString(nRow, "SupplierID", e.getAttribute("SupplierID")); |
| | | dw_goods.SetItemDisplayString(nRow, "SupplierID", e.getAttribute("SupplierID1")); |
| | | dw_goods.SetItemString(nRow, "POCreatorID", e.getAttribute("POCreatorID")); |
| | | dw_goods.SetItemDisplayString(nRow, "POCreatorID", e.getAttribute("POCreatorID1")); |
| | | dw_goods.SetItemString(nRow, "Picture", e.getAttribute("Picture")); |
| | | |
| | | if (dw_goods.GetItemString(nRow, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(nRow, "Packages") != "") |
| | | { |
| | | int qty1 = EvalQtyPerFCL45H(nRow); |
| | | dw_goods.SetItemString(nRow, "Packages45H", qty1.toString()); |
| | | dw_goods.SetItemDouble(nRow, "TransportationFee", 5000.0 / qty1); |
| | | } |
| | | dw_goods.Redraw(); |
| | | } |
| | | } |
| | | |
| | | else if (colname == "POPrice" || colname == "PaperCardPrice" || colname == "TransportationFee" || |
| | | colname == "OtherFee" || colname == "ManagementFee") |
| | | { |
| | | dw_goods.SetItemDouble(row, "UnitCost", EvalCost(row)); |
| | | |
| | | if ((colname == "POPrice" || colname == "PaperCardPrice") && dw_goods.GetItemString(row, "VATRefundRate") != "") |
| | | { |
| | | dw_goods.SetItemDouble(row, "VATRefund", EvalRefund(row)); |
| | | } |
| | | } |
| | | else if (colname == "VATRefundRate" && value != "") |
| | | { |
| | | dw_goods.SetItemDouble(row, "VATRefund", EvalRefund(row)); |
| | | } |
| | | else if (colname == "VolumeDesc" || colname == "Packages") |
| | | { |
| | | if (dw_goods.GetItemString(row, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(row, "Packages") != "") |
| | | { |
| | | int qty = EvalQtyPerFCL45H(row); |
| | | dw_goods.SetItemString(row, "Packages45H", qty.toString()); |
| | | dw_goods.SetItemDouble(row, "TransportationFee", EvalTransportationFee(row)); |
| | | dw_goods.SetItemDouble(row, "UnitCost", EvalCost(row)); |
| | | } |
| | | } |
| | | else if (colname == "FobUnitPrice") |
| | | { |
| | | string CurrencyCode = dw_base.GetItemString(1, "CurrencyCode"); |
| | | string expRate = ""; |
| | | string exchRate = ""; |
| | | |
| | | xml x0 = ViewObject::RetrieveData("/sale/data/GDN3/profit/param", "item", "dcomp_amt"); |
| | | if (x0.GetXmlDoc().selectSingleNode("root/item/@value")) |
| | | expRate = x0.GetXmlDoc().selectSingleNode("root/item/@value").text; |
| | | x0 = ViewObject::RetrieveData("/sale/data/GDN3/profit/param", "item", "cryrate"); |
| | | if (x0.GetXmlDoc().selectSingleNode("root/item/@value")) |
| | | exchRate = x0.GetXmlDoc().selectSingleNode("root/item/@value").text; |
| | | double r1 = exchRate.toDouble(); |
| | | double r2 = expRate.toDouble(); |
| | | double val = value.toDouble(); |
| | | if (CurrencyCode == "RMB" || CurrencyCode == "CNY") |
| | | { |
| | | if (exchRate != "") |
| | | { |
| | | double ManagementFee = (val / r1) * r2; |
| | | double OtherFee = (val / r1) * 0.2; |
| | | dw_goods.SetItemDouble(row, "ManagementFee", ManagementFee); |
| | | dw_goods.SetItemDouble(row, "OtherFee", OtherFee); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | dw_goods.SetItemDouble(row, "ManagementFee", val * 0.15); |
| | | dw_goods.SetItemDouble(row, "OtherFee", val * 0.2); |
| | | } |
| | | dw_goods.SetItemDouble(row, "UnitCost", EvalCost(row)); |
| | | } |
| | | if (dw_goods.GetItemString(row, "FobUnitPrice") != "" && |
| | | dw_goods.GetItemString(row, "POPrice") != "" && |
| | | dw_goods.GetItemString(row, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(row, "Packages") != "") |
| | | { |
| | | dw_goods.SetItemDouble(row, "UnitProfit", EvalUnitProfit(row)); |
| | | dw_goods.SetItemDouble(row, "ProfitRate", EvalProfitRate(row)); |
| | | dw_goods.SetItemDouble(row, "SaleProfitRate", EvalSaleProfitRate(row)); |
| | | dw_goods.SetItemDouble(row, "ExchangeCostRate", EvalExchangeCostRate(row)); |
| | | } |
| | | |
| | | dw_goods.SetItemString(row, "ModifyDate", publiccode::GetCurrentDate()); |
| | | dw_goods.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnBaseItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname = hdr.colname; |
| | | string value = hdr.data; |
| | | |
| | | string dwname = "dw_base"; |
| | | if (value != "") |
| | | { |
| | | //trace("\r\nsupplierid:"+value); |
| | | msxml::IXMLDOMNodeList nlist = GetElement().selectNodes("//*[@name='" + dwname + "']/trans[@for='" + colname + "']"); |
| | | ViewObject::TransData(nlist, dw_base, hdr.row, colname, value); |
| | | } |
| | | if (colname == "ExchangeRate") |
| | | { |
| | | if (dw_goods.GetRowCount() > 0) |
| | | { |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | dw_goods.SetItemDouble(i, "UnitProfit", EvalUnitProfit(i)); |
| | | dw_goods.SetItemDouble(i, "ProfitRate", EvalProfitRate(i)); |
| | | dw_goods.SetItemDouble(i, "SaleProfitRate", EvalSaleProfitRate(i)); |
| | | dw_goods.SetItemDouble(i, "ExchangeCostRate", EvalExchangeCostRate(i)); |
| | | } |
| | | } |
| | | dw_goods.Redraw(); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnPriceEval() |
| | | { |
| | | OpenWindow("dev:xpage[eval.Enquiry3.vx]", cast(dw_goods as int)); |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnRowChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(row, "SKUNo"); |
| | | OnShowImage(skuno, row); |
| | | im.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnShowImage() |
| | | { |
| | | int rowCount = dw_goods.GetRowCount(); |
| | | string skunos; |
| | | for (int i = 1; i <= rowCount; i++) |
| | | { |
| | | string skuno = dw_goods.GetItemString(i, "SKUNo"); |
| | | if (i == 1) |
| | | skunos = skuno; |
| | | else |
| | | skunos += "," + skuno; |
| | | } |
| | | |
| | | xaserverarg arg_pic = new xaserverarg; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg("SKUNoList", skunos); |
| | | arg_pic.AddArg("ParentWindow", GetHWND().toString()); |
| | | arg_pic.AddArg("OpenFlag", "1"); |
| | | OpenWindow("dev:xpage[SKU.PictureView.Product3.vx]", cast(arg_pic as int)); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnShowImage(string skuno, int row) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | |
| | | xml xp = new xml; |
| | | xp.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg_pic = new xaserverarg; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg("SKUNo", skuno); |
| | | |
| | | string res = "/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo"; |
| | | string customerID = dw_base.GetItemString(1, "CustomerID"); |
| | | string customerItemNo = dw_goods.GetItemString(row, "CustomerItemNo"); |
| | | if (customerItemNo != "") |
| | | { |
| | | //trace(customerID+":"+customerItemNo); |
| | | res = "/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKUNo"; |
| | | arg_pic.AddArg("CustomerID", customerID); |
| | | arg_pic.AddArg("CustomerItemNo", customerItemNo); |
| | | } |
| | | |
| | | bool hasIamge = false; |
| | | if (url::get(res, arg_pic.GetString(), xp) != 1) |
| | | { |
| | | //trace(xp.GetXml()); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | //trace(xp.GetXml()); |
| | | msxml::IXMLDOMNodeList nlistp = xp.GetXmlDoc().selectNodes("ImageList/image"); |
| | | int lenp = nlistp.length; |
| | | for (int ip = 0; ip < lenp; ip++) |
| | | { |
| | | hasIamge = true; |
| | | msxml::IXMLDOMElement xitem = nlistp.item(ip); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | string goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, goodno); |
| | | } |
| | | } |
| | | if (!hasIamge) |
| | | { |
| | | res = "/sale/data/ProductLibrary3/pref/picture/imagelistSKUNo"; |
| | | if (url::get(res, arg_pic.GetString(), xp) != 1) |
| | | { |
| | | //trace(xp.GetXml()); |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | nlistp = xp.GetXmlDoc().selectNodes("ImageList/image"); |
| | | lenp = nlistp.length; |
| | | for (ip = 0; ip < lenp; ip++) |
| | | { |
| | | xitem = nlistp.item(ip); |
| | | picname = xitem.selectSingleNode("PicPath").text; |
| | | goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, goodno); |
| | | } |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int OnPrint() |
| | | { |
| | | if (dw_base.GetItemString(1, "EnquiryNo") == "") |
| | | { |
| | | alert("请先保存数据!"); |
| | | return 1; |
| | | } |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("EntityName", "Enquiry", ""); |
| | | arg.AddArg("EntityID", dw_base.GetItemString(1, "EnquiryID"), ""); |
| | | arg.AddArg("EntityNo", dw_base.GetItemString(1, "EnquiryNo"), ""); |
| | | int p = arg.ptr_native_; |
| | | openUrl("/sale/view/view.base/xpage/Template/PrintViewEx", p); |
| | | return 1; |
| | | } |
| | | |
| | | int ReSeqNo(string SeqNoColumn) |
| | | { |
| | | for (int i = 1; i <= dw_goods.GetRowCount(); i++) |
| | | { |
| | | dw_goods.SetItemString(i, SeqNoColumn, (i * 10).toString()); |
| | | } |
| | | dw_goods.Redraw(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAskGoodsNo() |
| | | { |
| | | int rowCount = dw_goods.GetRowCount(); |
| | | string skunos = ""; |
| | | |
| | | for (int i = 1; i <= rowCount; i++) |
| | | { |
| | | if (dw_goods.GetItemString(i, "SKUNo") != "" && dw_goods.GetItemString(i, "GoodsNo") == "" && dw_goods.GetItemString(i, "Submitter") == "") |
| | | { |
| | | if (skunos == "") |
| | | skunos = dw_goods.GetItemString(i, "SKUNo"); |
| | | else |
| | | skunos += "," + dw_goods.GetItemString(i, "SKUNo"); |
| | | } |
| | | } |
| | | xaserverarg arg = ViewObject::MakeArg(); |
| | | arg.AddArg("SKUNoList", skunos); |
| | | OpenWindow("dev:xpage[Product.FetchNo.vx]", cast(arg as int)); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmNewProduct") |
| | | { |
| | | //xaserverarg arg = new xaserverarg; |
| | | //arg.setNativePointer(arg.CreateInstance()); |
| | | openUrl("/sale/view/Enquiry3/xpage/quick/newestproduct", GetHWND()); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmPrint") return OnPrint(); |
| | | else if (comdid == "xmImage") |
| | | return OnShowImage(); |
| | | else if (comdid == "xmShare") |
| | | return OnShare(); |
| | | else if (comdid == "xmImportProduct") |
| | | { |
| | | string str = GetControl("goods").GetText(); |
| | | str = str.trim(); |
| | | if (str == "") |
| | | { |
| | | xaserverarg arg1 = new xaserverarg; |
| | | arg1.setNativePointer(arg1.CreateInstance()); |
| | | arg1.AddArg("HWND", GetHWND().toString()); |
| | | arg1.AddArg("CustomerID", dw_base.GetItemString(1, "CustomerID")); |
| | | OpenWindow("dev:xpage[Entity.Product.Select.vx]", cast(arg1 as int)); |
| | | int row = dw_goods.GetRow(); |
| | | if (row >= 1) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(row, "SKUNo"); |
| | | OnShowImage(skuno, row); |
| | | im.Redraw(); |
| | | } |
| | | } |
| | | else |
| | | ImportProductByText(str); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmSave") |
| | | { |
| | | OnSave(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmPriceEval") |
| | | return OnPriceEval(); |
| | | else if (comdid == "xmOpen") |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | OpenWindow("dev:xpage[SOEnquiry.list.vx]", cast(arg as int)); |
| | | if (arg.GetArgString("id") != "") return OnRetrieve(arg.GetArgString("id")); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmDeleteRow") |
| | | { |
| | | if (dw_goods.GetItemString(dw_goods.GetRow(), "QuoteNo") != "") |
| | | { |
| | | alert("产品已被应用,不能删除"); |
| | | return 1; |
| | | } |
| | | dw_goods.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmBOMSchema") |
| | | { |
| | | OpenWindow("dev:xpage[ProductSchema.vx]", 0); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmProductDesc") |
| | | { |
| | | xaserverarg arg2 = new xaserverarg; |
| | | arg2.setNativePointer(arg2.CreateInstance()); |
| | | int row2 = dw_goods.GetRow(); |
| | | if (row2 < 1) return 0; |
| | | string str2 = dw_goods.GetItemString(row2, "ProductDesc"); |
| | | arg2.AddArg("value", str2); |
| | | OpenWindow("dev:xpage[memo.edit.new.vx]", arg2.getNativePointer()); |
| | | if (arg2.GetArgString("comdid") == "xmOK") |
| | | { |
| | | str2 = arg2.GetArgString("value"); |
| | | dw_goods.AcceptText(); |
| | | dw_goods.SetItemString(row2, "ProductDesc", str2); |
| | | dw_goods.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmReSeqNo") |
| | | { |
| | | if (win32::MessageBox(GetHWND(), "是否重置序号!", "提示1", 1) == 2) |
| | | return 1; |
| | | return ReSeqNo("SeqNo"); |
| | | } |
| | | else if (comdid == "xmAddRow") |
| | | { |
| | | int nRow = dw_goods.InsertRow(0); |
| | | SetSeqNo(dw_goods, "SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, "UOMCode", "007"); |
| | | dw_goods.SetItemDisplayString(nRow, "UOMCode", "PCS"); |
| | | dw_goods.SetItemString(nRow, "KOPCode", "120"); |
| | | dw_goods.SetItemDisplayString(nRow, "KOPCode", "CTNS"); |
| | | |
| | | xaserverarg arg3 = new xaserverarg; |
| | | arg3.setNativePointer(arg3.CreateInstance()); |
| | | int row3 = dw_goods.GetRow(); |
| | | if (row3 < 1) return 0; |
| | | dw_goods.SetItemString(nRow, "SKUNo", dw_goods.GetItemString(row3, "SKUNo")); |
| | | dw_goods.SetItemString(nRow, "ItemID", dw_goods.GetItemString(row3, "ItemID")); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid.find("ImportXml:", 0) == 0) |
| | | { |
| | | string strImport = comdid.mid("ImportXml:".length(), 9999); |
| | | ImportProductByText(strImport); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmAskGoodsNo") |
| | | { |
| | | return OnAskGoodsNo(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnImgDBClicked(ref TNotifyEvent evt, int pr) |
| | | { |
| | | ref IMGNNMHDR nmtv = evt.pnmh; |
| | | string src = nmtv.path; |
| | | /*if(src.length() > 60) |
| | | src = src.right(44); |
| | | else |
| | | src=src.mid(src.find("Thumbs", 0)+6, 50); |
| | | */ |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | //arg.AddArg("src","/business/products/chanpin"+src); |
| | | arg.AddArg("src", src); |
| | | |
| | | //win::OpenWindow("dev:xpage[BigPicture.vx]",arg); |
| | | |
| | | int h = openUrl("/sale/view/ProductLibrary/xpage/bigpictureview", arg); |
| | | return 1; |
| | | /* |
| | | xwin x = new xwin; |
| | | x.setNativePointer(h); |
| | | m_winHwnd = x.GetHWND(); |
| | | |
| | | string sh = doc.GetXml(); |
| | | int p = cast(sh as int); |
| | | win32::SendMessage(m_winHwnd, 0x401, p, 0); |
| | | */ |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnItemAskStyle(ref TNotifyEvent evt, int p) |
| | | { |
| | | int DMS_CSSSTYLE = 0x8; |
| | | ref DWASKSTYLENMHDR hdr = trust(evt.pnmh as ref DWASKSTYLENMHDR); |
| | | int row = hdr.row; |
| | | int col = hdr.col; |
| | | string colname = hdr.colname; |
| | | |
| | | int rows = dw_goods.GetRowCount(); |
| | | if (row < 1 || row > rows) |
| | | { |
| | | return 1; |
| | | } |
| | | if (colname == "POPrice") |
| | | { |
| | | if (dw_goods.GetItemTipString(row, colname) != "") |
| | | { |
| | | hdr.mask = DMS_CSSSTYLE; |
| | | hdr.cssstyle = "color:#cc0000"; |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("dw_goods", "DWV_ITEMCHANGED", OnItemChanged); |
| | | AttachEvent("dw_base", "DWV_ITEMCHANGED", OnBaseItemChanged); |
| | | AttachEvent("im1", "IMG_LDBCLICK", OnImgDBClicked); |
| | | AttachEvent("dw_goods", "DWV_ROWFOCUSCHANGED", OnRowChanged); |
| | | AttachCloseWindow(); |
| | | AttachEvent("dw_goods", "DWV_ASKSTYLE", OnItemAskStyle); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRetrieve(string id) |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("id", id); |
| | | if (getUrl("/sale/data/Enquiry/maint", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_base.Retrieve(x); |
| | | dw_goods.Retrieve(x); |
| | | dw_base.Redraw(); |
| | | dw_goods.Redraw(); |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | if (dw_goods.GetRowCount() > 0) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(1, "SKUNo"); |
| | | OnShowImage(skuno, 1); |
| | | im.Redraw(); |
| | | } |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | //x.LoadXml("<Enquiry/>"); |
| | | //dw_base.RetrieveDiff(x); |
| | | //dw_goods.RetrieveDiff(x); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | //dw_goods.SetItemTipString(1,"POPrice","21.4 2018/07/08\r\n23.4 2018/07/12"); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | int Oncopy(string EnquiryID, string ItemID) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(GetParam()); |
| | | |
| | | |
| | | dw_base.SetItemString(1, "ValidDay", arg.GetArgString("ValidDay")); |
| | | dw_base.SetItemString(1, "SONo", arg.GetArgString("SONo")); |
| | | dw_base.SetItemString(1, "Remark", arg.GetArgString("Remark")); |
| | | dw_base.SetItemString(1, "Source", arg.GetArgString("Source")); |
| | | dw_base.SetItemString(1, "PayTerm", arg.GetArgString("PayTerm")); |
| | | dw_base.SetItemString(1, "SupplierID", arg.GetArgString("SupplierID")); |
| | | dw_base.SetItemDisplayString(1, "SupplierID", arg.GetArgString("SupplierID/@_displaystring")); |
| | | dw_base.SetItemString(1, "CustomerContactName", arg.GetArgString("CustomerContactName")); |
| | | dw_base.SetItemString(1, "ContactTel", arg.GetArgString("ContactTel")); |
| | | |
| | | string sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, "EnquiryDate", sdate); |
| | | string suserid = publiccode::GetUser().id; |
| | | string susername = publiccode::GetUser().name; |
| | | dw_base.SetItemString(1, "SalespersonID", suserid); |
| | | dw_base.SetItemDisplayString(1, "SalespersonID", susername); |
| | | dw_base.SetItemString(1, "CompanyID", "E9E3C542-062C-4957-B8F4-9B92C3E351FC"); |
| | | dw_base.SetItemDisplayString(1, "CompanyID", "宁波家尔佳进出口有限公司"); |
| | | |
| | | //xml x = QuoteView::Oncopy(EnquiryID,ItemID); |
| | | |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/Oncopy", "EnquiryID", EnquiryID, "ItemID", ItemID); |
| | | if (!x) return 1; |
| | | //alert(x.GetXml()); |
| | | msxml::IXMLDOMNodeList items = x.GetXmlDoc().selectNodes("/Enquiry/Item"); |
| | | int len = items.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | |
| | | msxml::IXMLDOMElement e = items.item(i); |
| | | dw_goods.InsertRow(i); |
| | | |
| | | int nRow = dw_goods.GetRow(); |
| | | |
| | | SetSeqNo(dw_goods, "SeqNo", nRow); |
| | | dw_goods.SetItemString(nRow, "UOMCode", "007"); |
| | | dw_goods.SetItemDisplayString(nRow, "UOMCode", "PCS"); |
| | | dw_goods.SetItemString(nRow, "KOPCode", "120"); |
| | | dw_goods.SetItemDisplayString(nRow, "KOPCode", "CTNS"); |
| | | if (e.selectSingleNode("ItemName"))dw_goods.SetItemString(nRow, "ItemName", e.selectSingleNode("ItemName").text); |
| | | if (e.selectSingleNode("GoodsNo"))dw_goods.SetItemString(nRow, "GoodsNo", e.selectSingleNode("GoodsNo").text); |
| | | if (e.selectSingleNode("SKUNo"))dw_goods.SetItemString(nRow, "SKUNo", e.selectSingleNode("SKUNo").text); |
| | | if (e.selectSingleNode("ItemMiniQty"))dw_goods.SetItemString(nRow, "ItemMiniQty", e.selectSingleNode("ItemMiniQty").text); |
| | | if (e.selectSingleNode("Picture"))dw_goods.SetItemString(nRow, "Picture", e.selectSingleNode("Picture").text); |
| | | if (e.selectSingleNode("ItemID"))dw_goods.SetItemString(nRow, "ItemID", e.selectSingleNode("ItemID").text); |
| | | if (e.selectSingleNode("ProductDesc"))dw_goods.SetItemString(nRow, "ProductDesc", e.selectSingleNode("ProductDesc").text); |
| | | if (e.selectSingleNode("Packing"))dw_goods.SetItemString(nRow, "Packing", e.selectSingleNode("Packing").text); |
| | | if (e.selectSingleNode("POPrice"))dw_goods.SetItemString(nRow, "POPrice", e.selectSingleNode("POPrice").text); |
| | | if (e.selectSingleNode("PriceType"))dw_goods.SetItemString(nRow, "PriceType", e.selectSingleNode("PriceType").text); |
| | | if (e.selectSingleNode("InnerQty"))dw_goods.SetItemString(nRow, "InnerQty", e.selectSingleNode("InnerQty").text); |
| | | if (e.selectSingleNode("PackingRate"))dw_goods.SetItemString(nRow, "PackingRate", e.selectSingleNode("PackingRate").text); |
| | | if (e.selectSingleNode("VolumeDesc"))dw_goods.SetItemString(nRow, "VolumeDesc", e.selectSingleNode("VolumeDesc").text); |
| | | if (e.selectSingleNode("SampleFee"))dw_goods.SetItemString(nRow, "SampleFee", e.selectSingleNode("SampleFee").text); |
| | | if (e.selectSingleNode("TestFee"))dw_goods.SetItemString(nRow, "TestFee", e.selectSingleNode("TestFee").text); |
| | | if (e.selectSingleNode("ModelFee"))dw_goods.SetItemString(nRow, "ModelFee", e.selectSingleNode("ModelFee").text); |
| | | if (e.selectSingleNode("BOMPartNo"))dw_goods.SetItemString(nRow, "BOMPartNo", e.selectSingleNode("BOMPartNo").text); |
| | | if (e.selectSingleNode("ModifyDate"))dw_goods.SetItemString(nRow, "ModifyDate", e.selectSingleNode("ModifyDate").text); |
| | | |
| | | if (e.selectSingleNode("EnquiryDate"))dw_goods.SetItemString(nRow, "EnquiryDate", e.selectSingleNode("EnquiryDate").text); |
| | | if (e.selectSingleNode("EnquiryPriceListID"))dw_goods.SetItemString(nRow, "EnquiryPriceListID", e.selectSingleNode("EnquiryPriceListID").text); |
| | | if (e.selectSingleNode("RelEnquiryLineID"))dw_goods.SetItemString(nRow, "RelEnquiryLineID", e.selectSingleNode("RelEnquiryLineID").text); |
| | | if (e.selectSingleNode("PirorEnquiryLineID"))dw_goods.SetItemString(nRow, "PirorEnquiryLineID", e.selectSingleNode("PirorEnquiryLineID").text); |
| | | if (e.selectSingleNode("RealEnquiryLineID"))dw_goods.SetItemString(nRow, "RealEnquiryLineID", e.selectSingleNode("RealEnquiryLineID").text); |
| | | if (e.selectSingleNode("category"))dw_goods.SetItemString(nRow, "category", e.selectSingleNode("category").text); |
| | | |
| | | |
| | | if (dw_goods.GetItemString(nRow, "VolumeDesc") != "" && |
| | | dw_goods.GetItemString(nRow, "Packages") != "") |
| | | { |
| | | int qty = EvalQtyPerFCL45H(nRow); |
| | | dw_goods.SetItemString(nRow, "Packages45H", qty.toString()); |
| | | dw_goods.SetItemDouble(nRow, "TransportationFee", 5000.0 / qty); |
| | | } |
| | | |
| | | } |
| | | return 1; |
| | | } |
| | | int OnInit() |
| | | { |
| | | //公司抬头、报价人、报价日期 |
| | | string sdate = publiccode::GetCurrentDate(); |
| | | dw_base.SetItemString(1, "EnquiryDate", sdate); |
| | | string suserid = publiccode::GetUser().id; |
| | | string susername = publiccode::GetUser().name; |
| | | dw_base.SetItemString(1, "SalespersonID", suserid); |
| | | dw_base.SetItemDisplayString(1, "SalespersonID", susername); |
| | | dw_base.SetItemString(1, "CompanyID", "E9E3C542-062C-4957-B8F4-9B92C3E351FC"); |
| | | dw_base.SetItemDisplayString(1, "CompanyID", "宁波家尔佳进出口有限公司"); |
| | | return 1; |
| | | } |
| | | |
| | | /* |
| | | pricebill: one of enquiry pricebill quote pricebill |
| | | */ |
| | | int RetrieveItemList(string items, string pricebill = "") |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | arg.AddArg("ItemList", items); |
| | | //alert(items); |
| | | string dataurl = "/sale/data/Enquiry/maint/items"; |
| | | if (pricebill == "pricebill") dataurl = "/sale/data/Enquiry/maint/pricelist/items"; |
| | | if (pricebill == "quote") dataurl = "/sale/data/Enquiry/FetchItemListByQuoteItemID"; |
| | | if (getUrl(dataurl, arg.GetString(), x) != 1) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | alert(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | trace("*****" + x.GetXml() + "*****"); |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | ReSeqNo("SeqNo"); |
| | | |
| | | |
| | | if (dw_goods.GetRowCount() > 0) |
| | | { |
| | | if (dw_goods.GetItemString(1, "customerno")) |
| | | { |
| | | dw_base.SetItemString(1, "CustomerNo", dw_goods.GetItemString(1, "customerno")); |
| | | } |
| | | imageview im = GetControl("im1"); |
| | | im.ResetEx(); |
| | | string skuno = dw_goods.GetItemString(1, "SKUNo"); |
| | | OnShowImage(skuno, 1); |
| | | im.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_goods = GetControl("dw_goods"); |
| | | //dw_goods .openUrl("/sale/view/Enquiry3/template/goods"); |
| | | dw_goods.openUrl("/sale/view/Enquiry3/template/item/pricelist"); |
| | | dw_goods.SetColumnState("ItemID", false); |
| | | //dw_goods.SetColumnState("Picture",false); |
| | | dw_goods.SetColumnState("category", false); |
| | | dw_goods.SetColumnState("RealEnquiryLineID", false); |
| | | dw_goods.SetColumnState("RelEnquiryLineID", false); |
| | | dw_goods.SetColumnState("BOMPartNo", false); |
| | | |
| | | dw_base = GetControl("dw_base"); |
| | | |
| | | if (GetParam()) |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(GetParam()); |
| | | |
| | | sheetname = arg.GetArgString("sheetname"); |
| | | if (sheetname == "tab_list2") |
| | | { |
| | | dw_base.openUrl("/sale/view/Enquiry3/template/base2"); |
| | | //dw_base.SetItemString(1,"Source","客户询价"); |
| | | dw_goods.SetColumnState("SupplierID", true); |
| | | } |
| | | else |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | dw_base.openUrl("/sale/view/Enquiry3/template/base"); |
| | | //dw_base.SetItemString(1,"Source","客户询价"); |
| | | dw_goods.SetColumnState("SupplierID", false); |
| | | } |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | string EnquiryNo = arg.GetArgString("EnquiryNo"); |
| | | string EnquiryID = arg.GetArgString("EnquiryID"); |
| | | string ItemID = arg.GetArgString("ItemID"); |
| | | if (EnquiryNo == "") EnquiryNo = arg.GetArgString("EntityNo"); |
| | | if (EnquiryNo != "") |
| | | { |
| | | OnRetrieve(EnquiryNo); |
| | | |
| | | } |
| | | else if (EnquiryID != "") { |
| | | Oncopy(EnquiryID, ItemID); |
| | | } |
| | | else |
| | | { |
| | | OnInit(); |
| | | |
| | | if (arg.GetArgString("CustomerID") != "") |
| | | { |
| | | dw_base.SetItemDisplayString(1, "SupplierID", arg.GetArgString("CustomerName")); |
| | | dw_base.ItemChangeTo(1, "SupplierID", arg.GetArgString("CustomerID")); |
| | | string dwname = "dw_base"; |
| | | string colname = "SupplierID"; |
| | | string value = arg.GetArgString("CustomerID"); |
| | | msxml::IXMLDOMNodeList nlist = GetElement().selectNodes("//*[@name='" + dwname + "']/trans[@for='" + colname + "']"); |
| | | ViewObject::TransData(nlist, dw_base, 1, colname, value); |
| | | } |
| | | |
| | | if (arg.GetArgString("EntityIDList") != "") |
| | | { |
| | | RetrieveItemList(arg.GetArgString("EntityIDList"), arg.GetArgString("Source")); |
| | | } |
| | | |
| | | } |
| | | } |
| | | else |
| | | OnInit(); |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | dw_base.SetEditUpperMode(true); |
| | | dw_goods.SetEditUpperMode(true); |
| | | dw_goods.SetAskStyle(true); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class EnquiryExQuoteWin : public frame |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | |
| | | int SetAgent() |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | 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 OnSearch() |
| | | { |
| | | |
| | | xml x = new xml; |
| | | string EnquiryNo; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = GetParam(); |
| | | xcontrol QuoteNo = GetControl("QuoteNo"); |
| | | EnquiryNo = QuoteNo.GetText(); |
| | | |
| | | //alert(EnquiryNo); |
| | | |
| | | //string PartyID = arg.GetArgString("PartyID"); |
| | | //x = ViewObject::RetrieveData("/sale/data/Customerv3/entity/XmShare"); |
| | | |
| | | x = ViewObject::RetrieveData("/sale/data/Quote3/maint", "id", EnquiryNo); |
| | | if (x)dw_list.Retrieve(x); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | dw_list.Redraw(); |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@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) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnSaveAs() |
| | | { |
| | | int i = dw_list.SaveAs(""); |
| | | if (i == 1) |
| | | alert("导出成功"); |
| | | return 1; |
| | | } |
| | | |
| | | int OnMatch() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | string items = ""; |
| | | while (row > 0 && row <= dw_list.GetRowCount()) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string id = e.selectSingleNode("@guid").text; |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | if (items == "") |
| | | items = id; |
| | | else |
| | | items += "," + id; |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | xml x = ViewObject::RetrieveData("/sale/data/Enquiry/Update/UpdateQuoteLine", "ItemList", items); |
| | | OnSearch(); |
| | | return 1; |
| | | } |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | int OnPriceListSupplierEx() |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("sheetname", "tab_list2"); |
| | | arg.AddArg("EntityName", "Enquiry3"); |
| | | arg.AddArg("EntityID", ""); |
| | | arg.AddArg("EntityNo", ""); |
| | | arg.AddArg("Source", "quote"); |
| | | arg.AddArg("QuoteNo", GetControl("QuoteNo").GetText()); |
| | | |
| | | } |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | string items = ""; |
| | | //while(row > 0 && row <= dw_list.GetRowCount()) |
| | | for (row = 1; row <= dw_list.GetRowCount(); row++) |
| | | { |
| | | msxml::IXMLDOMElement e = dw_list.GetRowElement(row); |
| | | string id = e.selectSingleNode("@guid").text; |
| | | |
| | | if (items == "") |
| | | items = id; |
| | | else |
| | | items += "," + id; |
| | | //row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | arg.AddArg("EntityIDList", items); |
| | | int p = arg.ptr_native_; |
| | | OpenWindow("dev:xpage[Enquiry.maint.vx]", p); |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if (comdid == "xmSearch") |
| | | { |
| | | OnSearch(); |
| | | return 1; |
| | | } |
| | | if (comdid == "xmMatch") |
| | | { |
| | | OnMatch(); |
| | | return 1; |
| | | } |
| | | if (comdid == "xmMaint") |
| | | { |
| | | //win32::HideWindow(1); |
| | | OnPriceListSupplierEx(); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if (comdid == "xmSave") |
| | | { |
| | | return 1; |
| | | } |
| | | if (comdid == "xmSaveAs") |
| | | { |
| | | return OnSaveAs(); |
| | | } |
| | | 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("xxx","xxx"); |
| | | if (getUrl("",arg.GetString(),x)!=1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | }else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | }*/ |
| | | |
| | | |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/Quote3/template/item/pricelist"); |
| | | dw_list.SetColumnState("ItemID", false); |
| | | dw_list.SetColumnState("Picture", false); |
| | | dw_list.SetColumnState("category", false); |
| | | dw_list.SetColumnState("RealEnquiryLineID", false); |
| | | dw_list.SetColumnState("RelEnquiryLineID", false); |
| | | |
| | | dw_list.SetSelectionMode(3); |
| | | |
| | | if (GetParam()) |
| | | { |
| | | string no = GetParam(); |
| | | |
| | | GetControl("QuoteNo").SetText(no); |
| | | OnSearch(); |
| | | } |
| | | |
| | | OnAttachEvent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "multi.vbind.vbind.wface.vd" |
| | | use "productlibrary.vd" |
| | | use "shoppingcart.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class EntityProductSelectWin : public xwin |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | int hObject = 0; |
| | | string CustomerID; |
| | | string SupplierID; |
| | | string m_customer; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | //产品库产品列表 |
| | | 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; |
| | | string agentFor; |
| | | msxml::IXMLDOMElement imageElement; |
| | | |
| | | string impStr; |
| | | string tname; |
| | | |
| | | int FillGoodsCarList() |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | xcombobox xc = GetControl("frame:cbx_goodscar"); |
| | | if (!xc) return 0; |
| | | xml x = ShoppingCartView::GetRoleList(CustomerID); |
| | | if (!x) return 0; |
| | | xc.SetText("==选择购物车=="); |
| | | |
| | | msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.getAttribute("name"); |
| | | xcombobox::AddItem(xc.GetId(), name); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int SetAgent() |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | else |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | msxml::IXMLDOMElement OnGetCarListRowElement(int row = 0) |
| | | { |
| | | if (row < 1) row = dwc_list.GetRow(); |
| | | if (row < 1 || row > dwc_list.GetRowCount()) return 0; |
| | | msxml::IXMLDOMElement e = g_xdoc_shoppingcart.getRowElement("data/Item", row); |
| | | return e; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | int OnShowImage(string skuid) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | //im.RemoveImage(); |
| | | im.ResetEx(); |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | xml xp = new xml; |
| | | xp.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg_pic = new xaserverarg; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg("SKUID", skuid); |
| | | if (url::get("/sale/data/ProductLibrary3/pref/picture/imagelistSKU", arg_pic.GetString(), xp) != 1) |
| | | { |
| | | trace("xxx", xp.GetXml()); |
| | | } |
| | | else |
| | | { |
| | | //trace(skuid+" "+xp.GetXml()); |
| | | imageElement = xp.GetXmlDoc().documentElement; |
| | | msxml::IXMLDOMNodeList nlistp = xp.GetXmlDoc().selectNodes("ImageList/image"); |
| | | int lenp = nlistp.length; |
| | | for (int ip = 0; ip < lenp; ip++) |
| | | { |
| | | msxml::IXMLDOMElement xitem = nlistp.item(ip); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | string goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, ""); |
| | | } |
| | | im.Redraw(); |
| | | //win32::SendMessage(im.GetId(),0x000f,0,1); |
| | | //win32::InvalidateRect(im.GetId(),cast(0 as ref xrect),true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnShowImage(string skuid, string customerItemNo) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | //im.RemoveImage(); |
| | | im.ResetEx(); |
| | | |
| | | xml xp = new xml; |
| | | xp.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg_pic = new xaserverarg; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg("SKUID", skuid); |
| | | arg_pic.AddArg("CustomerID", m_customer); |
| | | arg_pic.AddArg("CustomerItemNo", customerItemNo); |
| | | |
| | | if (url::get("/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKU", arg_pic.GetString(), xp) != 1) |
| | | { |
| | | trace("error:" + xp.GetXml()); |
| | | } |
| | | else |
| | | { |
| | | imageElement = xp.GetXmlDoc().documentElement; |
| | | msxml::IXMLDOMNodeList nlistp = xp.GetXmlDoc().selectNodes("ImageList/image"); |
| | | int lenp = nlistp.length; |
| | | for (int ip = 0; ip < lenp; ip++) |
| | | { |
| | | msxml::IXMLDOMElement xitem = nlistp.item(ip); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | string goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, ""); |
| | | } |
| | | im.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | |
| | | htmlctrl xs = GetControl("html_detail"); |
| | | string html = makeHtml(row); |
| | | xs.SetContent(html); |
| | | xs.Redraw(); |
| | | |
| | | string id = g_xdoc_product.getData(0, "data/Item", row, "@guid"); |
| | | OnShowImage(id); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnGoodsCarRowChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | |
| | | htmlctrl xs = GetControl("html_detail"); |
| | | string html = makeGoodscarHtml(row); |
| | | xs.SetContent(html); |
| | | xs.Redraw(); |
| | | string id = g_xdoc_shoppingcart.getData(0, "data/Item", row, "SKUID"); |
| | | if (m_customer != "") |
| | | { |
| | | string customerItemNo = g_xdoc_shoppingcart.getData(0, "data/Item", row, "CustomerItemNo"); |
| | | OnShowImage(id, customerItemNo); |
| | | } |
| | | else |
| | | { |
| | | OnShowImage(id); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int DeleteRow(int row) |
| | | { |
| | | int IDOK = 1; |
| | | int MB_OKCANCEL = 1; |
| | | int MB_ICONQUESTION = 32; |
| | | if (win32::MessageBox(GetHWND(), "确认删除指定的项,删除后将不能恢复?", "提示", MB_OKCANCEL | MB_ICONQUESTION) != IDOK) return 1; |
| | | string id = g_xdoc_product.getData(0, "data/Item", row, "@guid"); |
| | | |
| | | if (ProductLibraryView::DeleteItem(id) == 1) dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | |
| | | int SetSelectState(xdwgrid dw_obj, int state) |
| | | { |
| | | dw_obj.SetSelectionMode(3); |
| | | return 1; |
| | | } |
| | | |
| | | int OnCkbCLick(ref TEvent evt, int p) |
| | | { |
| | | xcheckbox cbx_1 = GetControl("frame:cbx1"); |
| | | int state = cbx_1.GetCheck(cbx_1.GetId()); |
| | | return SetSelectState(dw_list, state); |
| | | } |
| | | |
| | | int OnCkbCLick2(ref TEvent evt, int p) |
| | | { |
| | | xcheckbox cbx_2 = GetControl("frame:cbx2"); |
| | | int state = cbx_2.GetCheck(cbx_2.GetId()); |
| | | return SetSelectState(dwc_list, state); |
| | | } |
| | | |
| | | xml GetGoodsPropList(string guid) |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", guid); |
| | | if (url::get("/sale/data/SO/goods/goodsprop/list", arg.GetString(), x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert(error); |
| | | } |
| | | return x; |
| | | } |
| | | |
| | | |
| | | |
| | | string Up(string name) { |
| | | string str = name.mid(0, 2); |
| | | str = str.upper(); |
| | | return xaserver::UploadFile("product" + str, name + ".jpg", this.GetHWND(), "", false); |
| | | } |
| | | |
| | | int OnAddImage() { |
| | | if (m_customer != "") return OnAddImageEx(); |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dw_list.GetRow(); |
| | | if (row < 1 || row > dw_list.GetRowCount()) return 0; |
| | | |
| | | msxml::IXMLDOMElement e = g_xdoc_product.getRowElement("data/Item", row); |
| | | string skuid = g_xdoc_product.getData(0, "data/Item", row, "@guid"); |
| | | string SKUNo = g_xdoc_product.getData(0, "data/Item", row, "SKUNo"); |
| | | string id = ViewObject::GetGuid(); |
| | | string ret1 = Up(id); |
| | | if (ret1 == "-1") return -1; |
| | | if (ret1 == "0") |
| | | { |
| | | alert("上传图片失败"); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | string originfile = ret1; |
| | | //alert(originfile); |
| | | string ext = originfile.right(7); |
| | | if (ext.find(".") >= 0) |
| | | ext = ext.mid(ext.find(".") + 1, 9999); |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | ext = "jpg"; |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | // 图片名加入数据库 |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | x.LoadXml("<Item update.new='1' update.modify='1' guid='" + id + "'>" + |
| | | "<ProductPictureID>" + id + "</ProductPictureID>" + |
| | | "<OriginFile>" + originfile + "</OriginFile>" + |
| | | "<FileExt>" + ext + "</FileExt>" + |
| | | "<SKUID>" + skuid + "</SKUID>" + |
| | | "<Name>[" + SKUNo.trim() + "]</Name>" + |
| | | "<FileName>" + id + ".jpg</FileName>" + |
| | | "</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | alert(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | dw_list.SetItemString(row, "pic", "*"); |
| | | dw_list.Redraw(); |
| | | //刷新一下界面,显示图片 |
| | | OnShowImage(skuid); |
| | | return 1; |
| | | } |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | int OnAddImageEx() { |
| | | int row = dwc_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dwc_list.GetRow(); |
| | | if (row < 1 || row > dwc_list.GetRowCount()) return 0; |
| | | |
| | | msxml::IXMLDOMElement e = g_xdoc_shoppingcart.getRowElement("data/Item", row); |
| | | string skuid = g_xdoc_shoppingcart.getData(0, "data/Item", row, "SKUID"); |
| | | string SKUNo = g_xdoc_shoppingcart.getData(0, "data/Item", row, "SKUID/@__displaystring"); |
| | | CustomerID = m_customer; |
| | | string CustomerItemNo = g_xdoc_shoppingcart.getData(0, "data/Item", row, "CustomerItemNo"); |
| | | string id = ViewObject::GetGuid(); |
| | | string ret1 = Up(id); |
| | | if (ret1 == "-1") return -1; |
| | | if (ret1 == "0") |
| | | { |
| | | alert("上传图片失败"); |
| | | return -1; |
| | | } |
| | | string originfile = ret1; |
| | | string ext = originfile.right(7); |
| | | if (ext.find(".") >= 0) |
| | | ext = ext.mid(ext.find(".") + 1, 9999); |
| | | else |
| | | ext = "jpg"; |
| | | |
| | | // 图片名加入数据库 |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | x.LoadXml("<Item update.new='1' update.modify='1' guid='" + id + "'>" + |
| | | "<ProductPictureID>" + id + "</ProductPictureID>" + |
| | | "<OriginFile>" + originfile + "</OriginFile>" + |
| | | "<FileExt>" + ext + "</FileExt>" + |
| | | "<SKUID>" + skuid + "</SKUID>" + |
| | | "<CustomerItemNo>" + CustomerItemNo + "</CustomerItemNo>" + |
| | | "<CustomerID>" + CustomerID + "</CustomerID>" + |
| | | "<Name>[" + SKUNo.trim() + "]</Name>" + |
| | | "<FileName>" + id + ".jpg</FileName>" + |
| | | "</Item>" |
| | | ); |
| | | |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | dwc_list.SetItemString(row, "pic", "*"); |
| | | 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; |
| | | |
| | | imageview im = GetControl("im1"); |
| | | int index = im.GetSelectIndex(); |
| | | int count = im.GetImageCount(); |
| | | |
| | | if (count < 1) return 1; |
| | | |
| | | msxml::IXMLDOMNodeList images = imageElement.selectNodes("image"); |
| | | int length = images.length; |
| | | if (length < index) return 1; |
| | | |
| | | int MB_OKCANCEL = 0x00000001; |
| | | int IDOK = 1; |
| | | if (win32::MessageBox(GetHWND(), "确认删除当前图片?", "提示", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | string id = images.item(index).selectSingleNode("@guid").text; |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string str = "<Item update.modify='1' update.delete='1' guid='" + id + "'/>"; |
| | | arg.AddArg("content", str); |
| | | if (url::get("/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | if (count == 1) |
| | | { |
| | | dwc_list.SetItemString(row, "pic", ""); |
| | | dwc_list.Redraw(); |
| | | } |
| | | |
| | | string skuid = g_xdoc_shoppingcart.getData(0, "data/Item", row, "SKUID"); |
| | | string SKUNo = g_xdoc_shoppingcart.getData(0, "data/Item", row, "SKUID/@__displaystring"); |
| | | CustomerID = m_customer; |
| | | string CustomerItemNo = g_xdoc_shoppingcart.getData(0, "data/Item", row, "CustomerItemNo"); |
| | | OnShowImage(skuid, CustomerItemNo); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteImage() { |
| | | if (m_customer != "") return OnDeleteImageEx(); |
| | | |
| | | int row = dw_list.GetNextSelectRow(1); |
| | | if (row < 1) row = dw_list.GetRow(); |
| | | if (row < 1 || row > dw_list.GetRowCount()) return 0; |
| | | |
| | | imageview im = GetControl("im1"); |
| | | int index = im.GetSelectIndex(); |
| | | int count = im.GetImageCount(); |
| | | |
| | | if (count < 1) return 1; |
| | | |
| | | msxml::IXMLDOMNodeList images = imageElement.selectNodes("image"); |
| | | int length = images.length; |
| | | if (length < index) return 1; |
| | | |
| | | int MB_OKCANCEL = 0x00000001; |
| | | int IDOK = 1; |
| | | if (win32::MessageBox(GetHWND(), "确认删除当前图片?", "提示", MB_OKCANCEL) != IDOK) return 1; |
| | | |
| | | string id = images.item(index).selectSingleNode("@guid").text; |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | string str = "<Item update.modify='1' update.delete='1' guid='" + id + "'/>"; |
| | | arg.AddArg("content", str); |
| | | if (url::get("/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | if (count == 1) |
| | | { |
| | | dw_list.SetItemString(row, "pic", ""); |
| | | dw_list.Redraw(); |
| | | } |
| | | |
| | | msxml::IXMLDOMElement e1 = g_xdoc_product.getRowElement("data/Item", row); |
| | | string skuid = e1.getAttribute("guid"); |
| | | OnShowImage(skuid); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | xml GetGoodsPropListEx(string guid) |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | string fields = "<data>"; |
| | | |
| | | /* |
| | | fields +="<field name='HighestPrice' label='最高价'/>"; |
| | | fields +="<field name='LowestPrice' label='最低价'/>"; |
| | | |
| | | fields +="<field name='BulkPrice' label='散货价'/>"; |
| | | fields +="<field name='CardPrice' label='纸卡价'/>"; |
| | | fields +="<field name='BuyPrice' label='采购价'/>"; |
| | | fields +="<field name='SupplierID' label='货源'/>"; |
| | | */ |
| | | |
| | | fields += "<field name='Packing' label='包装方式'/>"; |
| | | fields += "<field name='PackingRate' label='每箱数量'/>"; |
| | | fields += "<field name='VolumeDesc' label='包装尺码'/>"; |
| | | fields += "<field name='GWPerPkg' label='毛重'/>"; |
| | | fields += "<field name='NWPerPkg' label='净重'/>"; |
| | | //fields +="<field name='DeveloperID' label='开发人员'/>"; |
| | | fields += "<field name='AttributeValue_1' label='产品属性'/>"; |
| | | //fields +="<field name='Remark' label='备注'/>"; |
| | | |
| | | fields += "</data>"; |
| | | x.LoadXml(fields); |
| | | |
| | | return x; |
| | | } |
| | | |
| | | string makeHtml(int row) |
| | | { |
| | | string id = g_xdoc_product.getData(0, "data/Item", row, "@guid"); |
| | | xml x = GetGoodsPropList(id); |
| | | xml x1 = GetGoodsPropListEx(id); |
| | | |
| | | string html = "<html><style> .text{ font-weight:400} .label { font-weight:400;}</style><body style='margin:2;background-color1:#ccdccc none #f0f0f0 none'>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >编号:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row, "No") + |
| | | "</span> <span style='font-weight:700;width:50;font-size:10pt' >类项:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row, "RefNo") + |
| | | "</span></div>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >货号:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row, "GoodsNo") + |
| | | "</span></div>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >品名:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row, "CName") + |
| | | "</span></div>"; |
| | | if (dw_list.GetItemString(row, "CSpec") != "") |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >规格:</span><span style='width:90;font-size:10pt'>" + dw_list.GetItemString(row, "CSpec") + |
| | | "</span></div>"; |
| | | |
| | | msxml::IXMLDOMNodeList fieldsEx = x1.GetXmlDoc().selectNodes("data/field"); |
| | | string ls_detail = ""; |
| | | string ls_item = ""; |
| | | string name; |
| | | string label; |
| | | int len = fieldsEx.length; |
| | | int i = 0; |
| | | |
| | | for (i = 0; i < len; true) |
| | | { |
| | | int cnt = 0; |
| | | ls_item = ""; |
| | | while (cnt < 2) |
| | | { |
| | | name = fieldsEx.item(i).selectSingleNode("@name").text; |
| | | label = fieldsEx.item(i).selectSingleNode("@label").text; |
| | | ls_item += "<td>" + label + "</td>" + "<td style='text-align:center'>" + g_xdoc_product.getData(0, "data/Item", row, name) + "</td>"; |
| | | cnt++; |
| | | i++; |
| | | if (i == len)break; |
| | | } |
| | | ls_detail += "<tr>" + ls_item + "</tr>"; |
| | | } |
| | | html += "<div style='margin-left:8px;margin-right:16px;'>" + |
| | | +"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>" |
| | | + ls_detail |
| | | + "</table>" |
| | | + "</div>"; |
| | | |
| | | string ls_star = ""; |
| | | msxml::IXMLDOMNodeList fields = x.GetXmlDoc().selectNodes("data/field"); |
| | | len = fields.length; |
| | | |
| | | ls_detail = ""; |
| | | if (len > 0) |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >技术要求:</span></div>"; |
| | | for (i = 0; i < len; true) |
| | | { |
| | | ls_item = ""; |
| | | |
| | | int count = 0; |
| | | while (count < 2) |
| | | { |
| | | name = fields.item(i).selectSingleNode("@name").text; |
| | | label = fields.item(i).selectSingleNode("@label").text; |
| | | |
| | | if (name == "QualityTerm" || name == "PackTerm" || label == "质量" || label == "包装质量" || label == "技术要求") |
| | | { |
| | | i++; |
| | | if (i >= len)count = 2; |
| | | continue; |
| | | } |
| | | else if (g_xdoc_product.getData(0, "data/Item", row, name) == "") |
| | | { |
| | | msxml::IXMLDOMNodeList options = fields.item(i).selectNodes("item"); |
| | | int tlen = options.length; |
| | | string terms = ""; |
| | | for (int k = 0; k < tlen; k++) |
| | | { |
| | | if (options.item(k).text) |
| | | { |
| | | if (k > 0) terms += ", "; |
| | | terms += "[" + options.item(k).text + "]"; |
| | | } |
| | | } |
| | | ls_star += "<div ><span style='font-weight:700;width:50;font-size:10pt' >" + label + "*:</span><span style='width:90;font-size:10pt'>" + terms + "</span></div>"; |
| | | } |
| | | else |
| | | { |
| | | ls_item = "<td>" + label + "</td>" + "<td>" + g_xdoc_product.getData(0, "data/Item", row, name) + "</td>"; |
| | | count++; |
| | | } |
| | | i++; |
| | | if (i >= len)count = 2; |
| | | } |
| | | ls_item = "<tr>" + ls_item + "</tr>"; |
| | | ls_detail += ls_item; |
| | | } |
| | | |
| | | html += "<div style='margin-left:8px;margin-right:16px;'>" + |
| | | +"<table><colgroup span='1' width='70'/><colgroup span='1' width='120'/><colgroup span='1' width='70'/><colgroup span='1' width='120'/>" |
| | | + ls_detail |
| | | + "</table>" |
| | | + "</div>"; |
| | | if (dw_list.GetItemString(row, "QualityTerm") != "") |
| | | { |
| | | html += "<div style='height:12px'/>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >质量:</span></div>"; |
| | | html += "<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row, "QualityTerm") + "</span></div>"; |
| | | } |
| | | |
| | | if (dw_list.GetItemString(row, "PackTerm") != "") |
| | | { |
| | | html += "<div style='height:12px'/>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >包装质量:</span></div>"; |
| | | html += "<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row, "PackTerm") + "</span></div>"; |
| | | } |
| | | |
| | | if (g_xdoc_product.getData(0, "data/Item", row, "Remark") != "" && id == "23A8BBA2-DEF1-4C00-978E-646151A6082E") |
| | | { |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >备注:</span></div>"; |
| | | html += "<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + g_xdoc_product.getData(0, "data/Item", row, "Remark") + "</span></div>"; |
| | | } |
| | | |
| | | html += "<div style='height:24px'/>"; |
| | | |
| | | //星标项 |
| | | html += ls_star; |
| | | |
| | | //显示图片 |
| | | /*string picname = "1FA9E331-F95C-4E51-B80C-73FB9B911D8D.jpg";//dw_list.GetItemString(row,"ImgName"); //ItemID+".jpg"; |
| | | string str = picname.mid(0,2); |
| | | str = str.upper(); |
| | | string serversrc ="http://192.168.7.241:1001/business/products/chanpin/"+str+"/"+picname; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >ͼƬ:</span>"; |
| | | html += "<control visible='layer' controlclass='ximage' data='' src='"+ serversrc +"'/></div>"; |
| | | */ |
| | | html += "</body></html>"; |
| | | return html; |
| | | } |
| | | |
| | | string makeGoodscarHtml(int row) |
| | | { |
| | | string No = dwc_list.GetItemString(row, "RefNo");//获取属性值id |
| | | xml x = GetGoodsPropList(No); |
| | | |
| | | string html = "<html><style> .text{ font-weight:400} .label { font-weight:400;}</style><body style='margin:2;background-color1:#ccdccc none #f0f0f0 none'>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >编号:</span><span style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row, "No") + |
| | | "</span></div>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >品名:</span><span style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row, "CName") + |
| | | "</span></div>"; |
| | | html += "<div ><span style='font-weight:700;width:50;font-size:10pt' >规格:</span><span style='width:90;font-size:10pt'>" + dwc_list.GetItemString(row, "CSpec") + |
| | | "</span></div>"; |
| | | |
| | | msxml::IXMLDOMNodeList fields = x.GetXmlDoc().selectNodes("data/field"); |
| | | int len = fields.length; |
| | | html += "<table>" + |
| | | "<colgroup span='1' width='80'/>" + |
| | | "<colgroup span='1' width='120'/>" + |
| | | "<colgroup span='1' width='420'/>"; |
| | | html += "<tr>"; |
| | | html += "<td style='text-align:center'>编号</td><td style='text-align:center'>项目</td><td style='text-align:center'>内容</td>"; |
| | | html += "</tr>"; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | string name = fields.item(i).selectSingleNode("@name").text; |
| | | string label = fields.item(i).selectSingleNode("@label").text; |
| | | html += "<tr>"; |
| | | if (i == 0) |
| | | html += "<td rowspan='" + len.toString() + "'>" + No + "</td><td >" + label + "</td><td >" + "</td>"; |
| | | else |
| | | html += "<td >" + label + "</td><td >" + g_xdoc_shoppingcart.getData(0, "data/Item", row, name) + "</td>"; |
| | | html += "</tr>"; |
| | | } |
| | | |
| | | html += "<tr>"; |
| | | html += "<td rowspan='3'>" + g_xdoc_shoppingcart.getData(0, "data/Item", row, "PackCode") + "</td><td >包装方式</td><td >" + |
| | | g_xdoc_shoppingcart.getData(0, "data/Item", row, "CPack") + "</td>"; |
| | | html += "</tr>"; |
| | | html += "<tr height='48'>"; |
| | | html += "<td >包装要求</td><td >" + g_xdoc_shoppingcart.getData(0, "data/Item", row, "PackQualityTerm") + "</td>"; |
| | | html += "</tr>"; |
| | | html += "<tr>"; |
| | | html += "<td >侧唛</td><td ></td>"; |
| | | html += "</tr>"; |
| | | |
| | | html += "<tr height='72'>"; |
| | | html += "<td>" + g_xdoc_shoppingcart.getData(0, "data/Item", row, "QualityCode") + "</td><td >质量要求</td><td >" + |
| | | g_xdoc_shoppingcart.getData(0, "data/Item", row, "QualityTerm") + "</td>"; |
| | | html += "</tr>"; |
| | | |
| | | html += "</table>"; |
| | | |
| | | html += "</body></html>"; |
| | | return html; |
| | | } |
| | | |
| | | int OnImport() |
| | | { |
| | | if (!hObject) return 1; |
| | | |
| | | int rw = 0; |
| | | string ls_nos = "ImportXml:"; |
| | | |
| | | if (impStr == "") |
| | | { |
| | | alert("请选择商品!"); |
| | | return 1; |
| | | } |
| | | if (tname == "已询价产品") |
| | | { |
| | | int row = dwc_list.GetNextSelectRow(1); |
| | | while (row > 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | if (dwc_list.GetItemString(row, "pic") != "*") |
| | | { |
| | | alert("第" + row.toString() + "行请增加产品图片!"); |
| | | return 1; |
| | | } |
| | | row = dwc_list.GetNextSelectRow(row + 1); |
| | | } |
| | | } |
| | | else { |
| | | row = dw_list.GetNextSelectRow(1); |
| | | while (row > 0) |
| | | { |
| | | if (dw_list.GetItemString(row, "pic") != "*") |
| | | { |
| | | alert("第" + row.toString() + "行请增加产品图片!"); |
| | | return 1; |
| | | } |
| | | row = dw_list.GetNextSelectRow(row + 1); |
| | | } |
| | | } |
| | | ls_nos += impStr; |
| | | |
| | | dwc_list.SelectRow(0, false); |
| | | dwc_list.Redraw(); |
| | | dw_list.SelectRow(0, false); |
| | | dw_list.Redraw(); |
| | | impStr = ""; |
| | | |
| | | win32::SendMessage(hObject, 0x401, ls_nos, 0); |
| | | alert("转入完成!"); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnSearch() |
| | | { |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | return RetrieveItem(hItem); |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | int DeleteRow(int row) |
| | | { |
| | | int IDOK = 1; |
| | | int MB_OKCANCEL = 1; |
| | | int MB_ICONQUESTION = 32; |
| | | if (win32::MessageBox(GetHWND(), "确认删除指定的项,删除后将不能恢复?", "提示", MB_OKCANCEL | MB_ICONQUESTION) != IDOK) return 1; |
| | | string id = g_xdoc_product.getData(0, "data/Item", row, "@guid"); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | if (ProductLibraryView::DeleteItem(id) == 1) dw_list.DeleteRow(0); |
| | | |
| | | }; |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | int hCursor; |
| | | string name = ""; |
| | | if (comdid == "xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmImport") |
| | | { |
| | | OnImport(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmSearch") |
| | | { |
| | | OnSearch(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmAdd") |
| | | { |
| | | ItemAdd(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmMaint") |
| | | { |
| | | ItemMaint(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmDelete") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | DeleteRow(row); |
| | | |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmAddImage") |
| | | { |
| | | return OnAddImage(); |
| | | } |
| | | else if (comdid == "xmDeleteImage") |
| | | { |
| | | return OnDeleteImage(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int ItemAdd() |
| | | { |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | string name = tv_folder.GetItemLabel(hTopItem); |
| | | |
| | | msxml::IXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | string guid = e.getAttribute("guid"); |
| | | if (guid == "") return 1; |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg("guid", e.getAttribute("guid")); |
| | | if (name == "个人产品") |
| | | arg.AddArg("FolderID", e.getAttribute("guid")); |
| | | else |
| | | arg.AddArg("CategoryID", e.getAttribute("guid")); |
| | | string No = e.getAttribute("CategoryNo"); |
| | | if (No == "") No = e.getAttribute("no"); |
| | | string Name = e.getAttribute("CName"); |
| | | if (Name == "") Name = e.getAttribute("cname"); |
| | | arg.AddArg("No", No); |
| | | arg.AddArg("CName", Name); |
| | | int p = arg; |
| | | OpenWindow("dev:xpage[Quick.Input.NewProductEx.vx]", p); |
| | | if (arg.GetArgString("data.modify") == "1")RetrieveItem(hItem); |
| | | return 1; |
| | | } |
| | | |
| | | int ItemMaint() |
| | | { |
| | | int hItem = tv_folder.GetSelectedItem(); |
| | | msxml::IXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | //string no = e.getAttribute("no"); |
| | | //if(no=="") return 1; |
| | | string guid = e.getAttribute("guid"); |
| | | if (guid == "") return 1; |
| | | |
| | | /* |
| | | if(no=="NP0000FS" || no=="UP0000FS") |
| | | { |
| | | OpenWindow("dev:xpage[PackSchemaMaint.goodslib.vx]"); |
| | | }else |
| | | { |
| | | int pr = g_xdoc_product; |
| | | OpenWindow("dev:xpage[ProductLibraryItemMaint.vx]",pr); |
| | | } |
| | | */ |
| | | //msxml::IXMLDOMElement ele = g_xdoc_product.getRowElement("data/Item", 1); |
| | | //alert(ele.xml); |
| | | |
| | | int pr = g_xdoc_product; |
| | | OpenWindow("dev:xpage[ProductLibraryItemMaint3.vx]", pr); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | //查找当前树项的顶级目录 |
| | | int LookupTopFolder(int hItem) |
| | | { |
| | | int hRoot = tv_folder.GetRootItem(); |
| | | while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); |
| | | return hItem; |
| | | } |
| | | |
| | | //插入产品类项的子项 |
| | | int MakeGoodsFolderItem(int hItem, string sno) |
| | | { |
| | | xml x = ProductLibraryView::GetTreeChildItems3(sno); |
| | | if (!x) return 0; |
| | | |
| | | msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//Item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.getAttribute("CName"); |
| | | string no = e.getAttribute("CategoryNo"); |
| | | string label = no.trim() + " " + name; |
| | | |
| | | int h = tv_folder.InsertChildItem(hItem, label, trust(e as int), 15); |
| | | tv_folder.SetItemChild(h, 1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //插入新产品目录子项 |
| | | int MakeUserGoodsFolderItem(int hItem, string sno) |
| | | { |
| | | xml x = ProductLibraryView::GetTreeUserChildItems3(sno); |
| | | if (!x) return 0; |
| | | |
| | | msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("//Item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.getAttribute("CName"); |
| | | string no = e.getAttribute("CategoryNo"); |
| | | string label = no.trim() + " " + name; |
| | | |
| | | int h = tv_folder.InsertChildItem(hItem, label, trust(e as int), 15); |
| | | string child = e.getAttribute("Childs"); |
| | | if (child == "") |
| | | tv_folder.SetItemChild(h, 1); |
| | | else if (child != "0") |
| | | tv_folder.SetItemChild(h, 1); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //插入购物车项 |
| | | int ExpandCatChildFolder(int hItem, msxml::IXMLDOMElement ele, int image) |
| | | { |
| | | msxml::IXMLDOMNodeList nlist = ele.SelectNodes("item"); |
| | | int len = nlist.length; |
| | | if (len > 0) tv_folder.SetItemChild(hItem, 1); |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.getAttribute("name"); |
| | | int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), image); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | int MakeGoodCarFolderItem(int hItem) |
| | | { |
| | | xml x = ShoppingCartView::GetSupplierRoleList(SupplierID); |
| | | if (!x) return 0; |
| | | msxml::IXMLDOMNodeList nlist = x.GetXmlDoc().SelectNodes("/data/item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.getAttribute("name"); |
| | | int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), 35); |
| | | ExpandCatChildFolder(h, e, 35); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树展开 |
| | | int OnTreeExpanding(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = evt.pnmh; |
| | | int hItem = nmtv.itemNew.hItem; |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | string name = tv_folder.GetItemLabel(hTopItem); |
| | | int child = tv_folder.GetChildItem(hItem); |
| | | string no = ""; |
| | | msxml::IXMLDOMElement e; |
| | | |
| | | if (name == "公司库" && !child) |
| | | { |
| | | no = ""; |
| | | if (hTopItem != hItem) |
| | | { |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute("categoryid"); |
| | | } |
| | | else |
| | | { |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute("categoryid"); |
| | | } |
| | | MakeGoodsFolderItem(hItem, no); |
| | | } |
| | | else if (name == "个人库" && !child) |
| | | { |
| | | no = ""; |
| | | if (hTopItem != hItem) |
| | | { |
| | | e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute("categoryid"); |
| | | MakeUserGoodsFolderItem(hItem, no); |
| | | } |
| | | } |
| | | else if (name == "已询价产品" && !child) |
| | | { |
| | | if (hItem == hTopItem)MakeGoodCarFolderItem(hItem); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int ResetAgent(string agentAsk) |
| | | { |
| | | if (agentFor != agentAsk) |
| | | { |
| | | agentFor = agentAsk; |
| | | m_agentNode = 0; |
| | | SetAgent(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int LookupCustomerFolder(int hItem) |
| | | { |
| | | while (true) |
| | | { |
| | | msxml::IXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement); |
| | | string str = e1.getAttribute("no"); |
| | | if (str.find("Customer:") >= 0) return hItem; |
| | | hItem = tv_folder.GetParentItem(hItem); |
| | | if (hItem == 0) break; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | string LookupCustomer(int hItem) |
| | | { |
| | | hItem = LookupCustomerFolder(hItem); |
| | | if (hItem == 0) return ""; |
| | | msxml::IXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement); |
| | | string str = e1.getAttribute("no"); |
| | | return str.mid("Customer:".length(), 9999); |
| | | } |
| | | |
| | | int RetrieveItem(int hItem) |
| | | { |
| | | int hTopItem = LookupTopFolder(hItem); |
| | | tname = tv_folder.GetItemLabel(hTopItem); |
| | | string selectname = tv_folder.GetItemLabel(hItem); |
| | | imageview im = GetControl("im1"); |
| | | m_customer = ""; |
| | | xcontrol query = GetControl("sl_search"); |
| | | string queryString = query.GetText(); |
| | | if (hTopItem == 0 && queryString != "") |
| | | { |
| | | tname = "已询价产品"; |
| | | selectname = "已询价产品"; |
| | | } |
| | | if (tname == "已询价产品") |
| | | { |
| | | if (agentFor != "goodscar")SwitchLayer("goodscarsheet", "sheetframe"); |
| | | ResetAgent("goodscar"); |
| | | if (selectname != tname) |
| | | { |
| | | msxml::IXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as msxml::IXMLDOMElement); |
| | | string str = e1.getAttribute("no"); |
| | | if (str == "Supplier") return 1; |
| | | if (str.find("Customer:") == 0 || str.find("SO:") == 0 || str.find("Supplier:") == 0 || str.find("Enquiry:") == 0) |
| | | { |
| | | m_customer = LookupCustomer(hItem); |
| | | if (str.find("Customer:") == 0) |
| | | dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodscustomerlist"); |
| | | else |
| | | dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodssolist"); |
| | | dwc_list.Reset(); |
| | | dwc_list.SetReadOnly(true); |
| | | if (queryString == "") |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str)); |
| | | else |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); |
| | | if (str.find("Supplier:") == 0) |
| | | { |
| | | if (dwc_list.GetRowCount() > 0) |
| | | { |
| | | OnShowImage(dwc_list.GetItemString(1, "SKUID")); |
| | | } |
| | | } |
| | | } |
| | | else if (e1.getAttribute("categoryid") != "") |
| | | { |
| | | |
| | | string categoryid = e1.getAttribute("categoryid"); |
| | | dwc_list.SetDataObject(ProductLibraryView::GetMaintListForm3(categoryid).GetXmlDoc()); |
| | | dwc_list.SetReadOnly(true); |
| | | dwc_list.Reset(); |
| | | if (queryString == "") |
| | | g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid)); |
| | | else |
| | | g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString, "")); |
| | | } |
| | | else |
| | | { |
| | | dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodssolist"); |
| | | dwc_list.SetReadOnly(true); |
| | | dwc_list.Reset(); |
| | | if (queryString == "") |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname)); |
| | | else |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); |
| | | } |
| | | dwc_list.PostRetrieve(); |
| | | dwc_list.Redraw(); |
| | | |
| | | if (dwc_list.GetRowCount() >= 1) |
| | | { |
| | | htmlctrl xs = GetControl("html_detail"); |
| | | xs.SetContent(makeGoodscarHtml(1)); |
| | | |
| | | if (m_customer != "") |
| | | { |
| | | string skuid = g_xdoc_shoppingcart.getData(0, "data/Item", 1, "SKUID"); |
| | | string customerItemNo = g_xdoc_shoppingcart.getData(0, "data/Item", 1, "CustomerItemNo"); |
| | | OnShowImage(skuid, customerItemNo); |
| | | } |
| | | } |
| | | else { |
| | | im.ResetEx(); |
| | | im.Redraw(); |
| | | |
| | | xs = GetControl("html_detail"); |
| | | xs.SetContent("<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>"); |
| | | } |
| | | xs.Redraw(); |
| | | } |
| | | else |
| | | { |
| | | if (queryString == "") |
| | | { |
| | | return 0; |
| | | } |
| | | else |
| | | { |
| | | str = "Supplier:All"; |
| | | g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); |
| | | dwc_list.PostRetrieve(); |
| | | dwc_list.Redraw(); |
| | | } |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (agentFor != "goodslib")SwitchLayer("goodslibsheet", "sheetframe"); |
| | | if (tname == "个人库") |
| | | ResetAgent("userlib"); |
| | | else |
| | | ResetAgent("goodslib"); |
| | | int hCursor = xutil::SetCursorWait(); |
| | | if (tname == "个人库" || tname == "公司库") |
| | | { |
| | | string no = "N000005"; |
| | | if (tname == "个人库") no = "U000005"; |
| | | if (hItem != hTopItem) |
| | | { |
| | | msxml::IXMLDOMElement e = tv_folder.GetItemData(hItem); |
| | | no = e.getAttribute("guid"); |
| | | } |
| | | |
| | | |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(no).GetXmlDoc()); |
| | | dw_list.Reset(); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetColumnState("Submitter1", false); |
| | | dw_list.SetColumnState("HSCode", false); |
| | | |
| | | xml x; |
| | | if (queryString == "") |
| | | { |
| | | if (tname == "个人库") |
| | | x = ProductLibraryView::GetMaintRoleList3(no); |
| | | else |
| | | x = ProductLibraryView::GetMaintList3(no); |
| | | if (x) |
| | | { |
| | | g_xdoc_product.Retrieve(x); |
| | | x.Free(); |
| | | } |
| | | } |
| | | else |
| | | { |
| | | if (tname == "个人库") |
| | | { |
| | | x = ProductLibraryView::GetMaintRoleList3(no, queryString); |
| | | } |
| | | else |
| | | { |
| | | if (queryString != "") |
| | | { |
| | | if (no == "N000005") |
| | | x = ProductLibraryView::GetMaintList3("", queryString, ""); |
| | | else |
| | | x = ProductLibraryView::GetMaintList3(no, queryString, ""); |
| | | } |
| | | else |
| | | x = ProductLibraryView::GetMaintList3(no); |
| | | } |
| | | if (x)g_xdoc_product.Retrieve(x); |
| | | } |
| | | dw_list.PostRetrieve(); |
| | | dw_list.Redraw(); |
| | | |
| | | if (dw_list.GetRowCount() > 0) |
| | | { |
| | | xs = GetControl("html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | string id = g_xdoc_product.getData(0, "data/Item", 1, "@guid"); |
| | | OnShowImage(id); |
| | | } |
| | | else |
| | | { |
| | | im.ResetEx(); |
| | | im.Redraw(); |
| | | |
| | | xs = GetControl("html_detail"); |
| | | xs.SetContent("<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>"); |
| | | } |
| | | xs.Redraw(); |
| | | xutil::RestoreCursor(hCursor); |
| | | } |
| | | } |
| | | impStr = ""; |
| | | } |
| | | |
| | | int OnTreeSelChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW); |
| | | int hItem = nmtv.itemNew.hItem; |
| | | return RetrieveItem(hItem); |
| | | } |
| | | |
| | | int ExpandChildFolder(int hItem, msxml::IXMLDOMElement pElement) |
| | | { |
| | | msxml::IXMLDOMNodeList nlist = pElement.SelectNodes("Item"); |
| | | int len = nlist.length; |
| | | for (int i = 0; i < len; i++) |
| | | { |
| | | msxml::IXMLDOMElement e = nlist.item(i); |
| | | string name = e.getAttribute("cname"); |
| | | string sImage = e.getAttribute("image"); |
| | | int image = 15; |
| | | //if(sImage) image = sImage.toInt(); |
| | | int h = tv_folder.InsertChildItem(tv_folder.GetId(), hItem, name, trust(e as int), image); |
| | | tv_folder.SetItemChild(h, 1); |
| | | ExpandChildFolder(h, e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int InitialFolder() |
| | | { |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement e = xframeElement.selectSingleNode("//xtree[@name='tv_folder']/initial"); |
| | | ExpandChildFolder(0, e); |
| | | return 1; |
| | | } |
| | | |
| | | int OnDwClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR); |
| | | char ch; |
| | | int row = hdr.row; |
| | | string col = hdr.colname; |
| | | |
| | | string str = ""; |
| | | if (dw_list.GetItemString(row, "SKUNo") != "") |
| | | str = dw_list.GetItemString(row, "SKUNo"); |
| | | else |
| | | str = dw_list.GetItemString(row, "No"); |
| | | |
| | | if (dw_list.IsRowSelected(row) & 0xff) |
| | | { |
| | | //will unselect |
| | | impStr = impStr.replace(" " + str, ""); |
| | | } |
| | | else |
| | | { |
| | | //will select |
| | | impStr += " " + str; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDwcClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR); |
| | | char ch; |
| | | int row = hdr.row; |
| | | string col = hdr.colname; |
| | | string str = g_xdoc_shoppingcart.getData(0, "data/Item", row, "SOLineID"); |
| | | if (str != "") |
| | | str = "sl:" + str; |
| | | else if (dwc_list.GetItemString(row, "SKUNo") != "") |
| | | str = dwc_list.GetItemString(row, "SKUNo"); |
| | | else |
| | | str = dwc_list.GetItemString(row, "No"); |
| | | |
| | | if (dwc_list.IsRowSelected(row) & 0xff) |
| | | { |
| | | //will unselect |
| | | impStr = impStr.replace(" " + str, ""); |
| | | } |
| | | else |
| | | { |
| | | //will select |
| | | impStr += " " + str; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDwcDoubleClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | string ls_nos = "ImportXml:"; |
| | | string str = g_xdoc_shoppingcart.getData(0, "data/Item", row, "SOLineID"); |
| | | string str1 = g_xdoc_shoppingcart.getData(0, "data/Item", row, "EnquiryPriceListID"); |
| | | if (str1 != "") |
| | | str += "el:" + str1; |
| | | else if (str != "") |
| | | str = "sl:" + str; |
| | | else if (dwc_list.GetItemString(row, "SKUNo") != "") |
| | | str = dwc_list.GetItemString(row, "SKUNo"); |
| | | else |
| | | str = dwc_list.GetItemString(row, "No"); |
| | | ls_nos += str; |
| | | |
| | | dw_list.SelectRow(0, false); |
| | | dwc_list.SelectRow(0, false); |
| | | dw_list.Redraw(); |
| | | dwc_list.Redraw(); |
| | | impStr = ""; |
| | | win32::SendMessage(hObject, 0x401, ls_nos, 0); |
| | | xutil::RestoreCursor(hCursor); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | int OnDwDoubleClicked(ref TNotifyEvent evt, int p) |
| | | { |
| | | int hCursor = xutil::SetCursorWait(); |
| | | ref DWNMHDR hdr = cast(evt.pnmh as ref DWNMHDR); |
| | | int row = hdr.row; |
| | | if (row > 0) |
| | | { |
| | | if (dw_list.GetItemString(row, "pic") != "*") |
| | | { |
| | | alert("第" + row.toString() + "行请增加产品图片!"); |
| | | return 1; |
| | | } |
| | | } |
| | | string ls_nos = "ImportXml:"; |
| | | string str = ""; |
| | | if (dw_list.GetItemString(row, "SKUNo") != "") |
| | | str = dw_list.GetItemString(row, "SKUNo"); |
| | | else |
| | | str = dw_list.GetItemString(row, "No"); |
| | | ls_nos += str; |
| | | dw_list.SelectRow(0, false); |
| | | dwc_list.SelectRow(0, false); |
| | | dw_list.Redraw(); |
| | | dwc_list.Redraw(); |
| | | impStr = ""; |
| | | win32::SendMessage(hObject, 0x401, ls_nos, 0); |
| | | xutil::RestoreCursor(hCursor); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("dw_list", "DWV_ROWFOCUSCHANGED", OnRowChanged); |
| | | AttachEvent("dwc_list", "DWV_ROWFOCUSCHANGED", OnGoodsCarRowChanged); |
| | | AttachEvent("tv_folder", "TVN_ITEMEXPANDING", OnTreeExpanding); |
| | | AttachEvent("tv_folder", "TVN_SELCHANGED", OnTreeSelChanged); |
| | | AttachEvent("WM_COMMAND", OnCkbCLick); //checkbox打钩事件 |
| | | AttachEvent("WM_COMMAND", OnCkbCLick2); //checkbox打钩事件 |
| | | |
| | | AttachEvent("dwc_list", "DWV_DOUBLECLICKED", OnDwcDoubleClicked); |
| | | AttachEvent("dw_list", "DWV_DOUBLECLICKED", OnDwDoubleClicked); |
| | | |
| | | AttachEvent("dw_list", "DWV_CLICKED", OnDwClicked); |
| | | AttachEvent("dwc_list", "DWV_CLICKED", OnDwcClicked); |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | agentFor = "goodslib"; |
| | | impStr = ""; |
| | | |
| | | OnAttachEvent(); |
| | | imageElement = 0; |
| | | |
| | | tv_folder = GetControl("tv_folder"); |
| | | dw_list = GetControl("dw_list"); |
| | | dwc_list = GetControl("dwc_list"); |
| | | |
| | | xaserverarg arg = GetParam(); |
| | | CustomerID = ""; |
| | | SupplierID = ""; |
| | | m_customer = ""; |
| | | hObject = 0; |
| | | if (arg) |
| | | { |
| | | hObject = arg.GetArgString("HWND").toInt(); |
| | | CustomerID = arg.GetArgString("CustomerID"); |
| | | CustomerID = arg.GetArgString("SupplierID"); |
| | | } |
| | | InitialFolder(); |
| | | |
| | | g_xdoc_product = new xdataset; |
| | | g_xdoc_product.Init(); |
| | | xbind bindproduct = new xbind; |
| | | bindproduct.bindEx(dw_list, g_xdoc_product, ""); |
| | | |
| | | g_xdoc_shoppingcart = new xdataset; |
| | | g_xdoc_shoppingcart.Init(); |
| | | |
| | | xbind bindcart = new xbind; |
| | | bindcart.bindEx(dwc_list, g_xdoc_shoppingcart, ""); |
| | | |
| | | dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3("").GetXmlDoc()); |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.SetReadOnly(true); |
| | | dw_list.SetColumnState("Submitter1", false); |
| | | dw_list.SetColumnState("HSCode", false); |
| | | |
| | | dwc_list.openUrl("/sale/view/ProductLibrary/template/cart/goodssolist"); |
| | | dwc_list.SetReadOnly(true); |
| | | |
| | | if (dw_list.GetRowCount()) |
| | | { |
| | | htmlctrl xs = GetControl("html_detail"); |
| | | xs.SetContent(makeHtml(1)); |
| | | } |
| | | |
| | | xtreeview::ExpandItem(tv_folder.GetId(), |
| | | xtreeview::GetNextItem(tv_folder.GetId(), xtreeview::GetRootItem(tv_folder.GetId()))); |
| | | xtreeview::ExpandItem(tv_folder.GetId(), |
| | | xtreeview::GetNextItem(tv_folder.GetId(), xtreeview::GetNextItem(tv_folder.GetId(), xtreeview::GetRootItem(tv_folder.GetId())))); |
| | | |
| | | dw_list.SetSelectionMode(3); |
| | | dwc_list.SetSelectionMode(3); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class PurcharItemSelectWin : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int SetAgent() |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | //重置工具条 |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | int OnFilter() |
| | | { |
| | | string str = GetControl("sl_search").GetText(); |
| | | xdwgrid dw_obj; |
| | | dw_list.Filter("*", str); |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | int OnOK() |
| | | { |
| | | int rw = dw_list.GetNextSelectRow(1); |
| | | string content = "<data>"; |
| | | while (rw > 0) |
| | | { |
| | | msxml::IXMLDOMElement xe = dw_list.GetRowElement(rw); |
| | | content += xe.xml; |
| | | rw = dw_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | content += "</data>"; |
| | | xaserverarg arg = GetParam(); |
| | | arg.AddArg("process", "ok"); |
| | | arg.AddArg("result", content); |
| | | |
| | | CloseWindow(); |
| | | } |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmSearch") |
| | | { |
| | | OnFilter(); |
| | | return 0; |
| | | } |
| | | if (comdid == "xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if (comdid == "xmOK") |
| | | { |
| | | /*int rw = dw_list.GetNextSelectRow(1); |
| | | string content = "<data>"; |
| | | while (rw>0) |
| | | { |
| | | msxml::IXMLDOMElement xe = dw_list.GetRowElement(rw); |
| | | content += xe.xml; |
| | | rw = dw_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | content += "</data>"; |
| | | xaserverarg arg = GetParam(); |
| | | arg.AddArg("process","ok"); |
| | | arg.AddArg("result",content); |
| | | |
| | | CloseWindow();*/ |
| | | OnOK(); |
| | | 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("dw_list", "DWV_DOUBLECLICKED", OnOK); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = GetParam(); |
| | | if (getUrl("/sale/data/Enquiry/PriceList/ItemSelect", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/Enquiry3/template/purcharpricelist/item"); |
| | | dw_list.SetReadOnly(true); |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | dw_list.SetSelectionMode(3); |
| | | xaserverarg arg = GetParam(); |
| | | arg.AddArg("process", ""); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class PurcharItemSelectExWin : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int SetAgent() |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | //重置工具条 |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | int OnFilter() |
| | | { |
| | | string str = GetControl("sl_search").GetText(); |
| | | xdwgrid dw_obj; |
| | | dw_list.Filter("*", str); |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | int xmOk() |
| | | { |
| | | int rw = dw_list.GetNextSelectRow(1); |
| | | string content = "<data>"; |
| | | while (rw > 0) |
| | | { |
| | | msxml::IXMLDOMElement xe = dw_list.GetRowElement(rw); |
| | | content += xe.xml; |
| | | rw = dw_list.GetNextSelectRow(rw + 1); |
| | | } |
| | | content += "</data>"; |
| | | xaserverarg arg = GetParam(); |
| | | arg.AddArg("process", "ok"); |
| | | arg.AddArg("result", content); |
| | | CloseWindow(); |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmSearch") |
| | | { |
| | | OnFilter(); |
| | | return 0; |
| | | } |
| | | if (comdid == "xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | if (comdid == "xmOK") |
| | | { |
| | | xmOk(); |
| | | 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("dw_list", "DWV_DOUBLECLICKED", xmOk); |
| | | |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = GetParam(); |
| | | if (getUrl("/sale/data/Enquiry/folder/listitems", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/Enquiry3/template/item/itempricelist"); |
| | | dw_list.SetReadOnly(true); |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | dw_list.SetSelectionMode(3); |
| | | xaserverarg arg = GetParam(); |
| | | arg.AddArg("process", ""); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | int onloaded() |
| | | { |
| | | //SetAgent(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class ProductSchemaWin : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | xdwtable dw_base; |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int SetAgent() |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmAddRow") |
| | | { |
| | | int row = dw_list.InsertRow(0); |
| | | string sdate = publiccode::GetCurrentDate(); |
| | | dw_list.SetItemString(row, "SKUID", dw_base.GetItemString(1, "SKUID")); |
| | | dw_list.SetItemDisplayString(row, "SKUID", dw_base.GetItemString(1, "SKUNo")); |
| | | dw_list.SetItemString(row, "GoodsNo", dw_base.GetItemString(1, "GoodsNo")); |
| | | dw_list.SetItemString(row, "CName", dw_base.GetItemString(1, "CName")); |
| | | dw_list.SetItemString(row, "ProductQty", "1"); |
| | | dw_list.SetItemString(row, "PartQty", "1"); |
| | | dw_list.SetItemString(row, "CreateDate", sdate); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmDeleteRow") |
| | | { |
| | | dw_list.DeleteRow(0); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmClose") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmSave") |
| | | { |
| | | return OnSave(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | int OnArgItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname = hdr.colname; |
| | | string value = hdr.data; |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | string dwname = "dw_base"; |
| | | if (value != "") |
| | | { |
| | | msxml::IXMLDOMNodeList nlist = GetElement().selectNodes("//*[@name='" + dwname + "']/trans[@for='" + colname + "']"); |
| | | ViewObject::TransData(nlist, dw_base, hdr.row, colname, value); |
| | | } |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x = xml::Make(); |
| | | xaserverarg arg = xaserverarg::Make(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/ProductLibrary3/update/product/schema", arg.GetString(), x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert("err:" + error); |
| | | x.Free(); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | //alert(str); |
| | | x.Free(); |
| | | if (str == "false") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | alert("保存失败!"); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | dw_list.ResetUpdateStatus(); |
| | | alert("保存成功!"); |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("dw_base", "DWV_ITEMCHANGED", OnArgItemChanged); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | dw_list.Reset(); |
| | | dw_list.Redraw(); |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | arg.AddArg("SKUID", dw_base.GetItemString(1, "SKUID")); |
| | | //alert(dw_base.GetItemString(1,"SKUID")); |
| | | if (getUrl("/sale/data/ProductLibrary3/ProductSchemaList", arg.GetString(), x) != 1) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/ProductLibrary/template/ProductSchema"); |
| | | dw_list.SetColumnState("CreateDate", false); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | dw_base = GetControl("dw_base"); |
| | | dw_base.openUrl("/sale/view/ProductLibrary/template/ProductArg"); |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | }; |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "base.view.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class ProductSchemaSelectWin : public xframe |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | xdwtable dw_base; |
| | | xdwgrid dw_list; |
| | | xnode m_agentNode; //Agent Condition |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int SetAgent() |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | string xfNodeAgentArea = "agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | if (m_agentNode) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | SetAgentNodeContent(anode, m_agentNode); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | else |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | msxml::IXMLDOMElement xframeElement = GetElement(); |
| | | msxml::IXMLDOMElement agent = xframeElement.selectSingleNode("agent/" + xfNodeAgentArea + "[1]/*"); |
| | | if (agent) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | string s = agent.xml; |
| | | m_agentNode = SetAgentNodeContent(anode, s); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(ref TEvent evt, int param) |
| | | { |
| | | //重置工具条 |
| | | SetAgent(); |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | //命令发布函数 |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | if (comdid == "xmOK") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1 || row > dw_list.GetRowCount()) return 1; |
| | | xaserverarg arg = GetParam(); |
| | | arg.AddArg("process", "ok"); |
| | | arg.AddArg("SKUID", dw_list.GetItemString(row, "SKUID")); |
| | | arg.AddArg("SchemaNo", dw_list.GetItemString(row, "SchemaNo")); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | else if (comdid == "xmCancel") |
| | | { |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@element").text(); |
| | | OnCreateTree(text); |
| | | changeddlb = 0; |
| | | return 1; |
| | | } |
| | | int OnArgItemChanged(ref TNotifyEvent evt, int p) |
| | | { |
| | | ref DWNMHDR hdr = trust(evt.pnmh as ref DWNMHDR); |
| | | string colname = hdr.colname; |
| | | string value = hdr.data; |
| | | |
| | | int OnDeleteRow() |
| | | { |
| | | int row = listwin::dw_list.GetNextSelectRow(1); |
| | | if (row < 1) { |
| | | row = listwin::dw_list.GetRow(); |
| | | if (row < 1) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | string dwname = "dw_base"; |
| | | if (value != "") |
| | | { |
| | | msxml::IXMLDOMNodeList nlist = GetElement().selectNodes("//*[@name='" + dwname + "']/trans[@for='" + colname + "']"); |
| | | ViewObject::TransData(nlist, dw_base, hdr.row, colname, value); |
| | | } |
| | | OnRetrieve(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnSave() |
| | | { |
| | | dw_list.AcceptText(); |
| | | xml x = xml::Make(); |
| | | xaserverarg arg = xaserverarg::Make(); |
| | | dw_list.DwUpdateAllToEx(x.GetXmlDoc()); |
| | | |
| | | arg.AddArg("content", x.GetXml()); |
| | | if (url::get("/sale/data/ProductLibrary3/update/product/schema", arg.GetString(), x) != 1) |
| | | { |
| | | string error = x.GetXmlDoc().text; |
| | | alert("err:" + error); |
| | | x.Free(); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | string str = x.GetXmlDoc().documentElement.getAttribute("text"); |
| | | x.Free(); |
| | | if (str == "false") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | alert("保存失败!"); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | alert("保存成功!"); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(ref TXCommandEvent evt, int param) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | //绑定工具条点击事件 |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | //获取焦点事件,用于重置工具条 |
| | | AttachEvent("WM_SETFOCUS", OnSetFocus); |
| | | AttachEvent("dw_base", "DWV_ITEMCHANGED", OnArgItemChanged); |
| | | } |
| | | |
| | | int OnRetrieve() |
| | | { |
| | | dw_list.Reset(); |
| | | dw_list.Redraw(); |
| | | |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | arg.AddArg("SKUID", dw_base.GetItemString(1, "SKUID")); |
| | | //alert(dw_base.GetItemString(1,"SKUID")); |
| | | if (getUrl("/sale/data/ProductLibrary3/ProductSchemaList", arg.GetString(), x) != 1) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | trace(x.GetXmlDoc().text); |
| | | return -1; |
| | | } |
| | | |
| | | else |
| | | { |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | } |
| | | dw_list.SetReadOnly(true); |
| | | return 1; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int onload() |
| | | { |
| | | dw_list = GetControl("dw_list"); |
| | | dw_list.openUrl("/sale/view/ProductLibrary/template/ProductSchema"); |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | dw_base = GetControl("dw_base"); |
| | | dw_base.openUrl("/sale/view/ProductLibrary/template/ProductArg"); |
| | | dw_base.SetColHeaderHeight(0); |
| | | dw_base.SetRowSelectorWidth(0); |
| | | dw_base.SetHScrollState(false); |
| | | dw_base.SetVScrollState(false); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | OnAttachEvent(); |
| | | OnRetrieve(); |
| | | |
| | | }; |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class SKUProductPictureView3 : public frame |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | imageview im; |
| | | xml doc; |
| | | int m_winHwnd; |
| | | int ParentHWND; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int hiddenBox(string name, bool f) |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@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) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | //xnode anode = GetAgentNode(name); |
| | | xnode anode = GetAgentNode(name); |
| | | int LayerFlow_None = 0x00000001; |
| | | int LayerFlow_UnLayer = 0x00000100; |
| | | int LayerFlow_NS = 0x00000004; |
| | | int LayerFlow_WE = 0x00000008; |
| | | int LayerFlow_Control = 0x00000010; |
| | | if (f) |
| | | anode.SetLayerFlow(LayerFlow_WE | LayerFlow_Control); |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | } |
| | | anode.SetLayerFlow(LayerFlow_None | LayerFlow_UnLayer); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | int OnImgDBClicked(ref TNotifyEvent evt, int pr) |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | ref IMGNNMHDR nmtv = evt.pnmh; |
| | | string src = nmtv.path; |
| | | /*if(src.length() > 60) |
| | | src = src.right(44); |
| | | else |
| | | src=src.mid(src.find("Thumbs", 0)+6, 50); |
| | | */ |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | //arg.AddArg("src","/business/products/chanpin"+src); |
| | | arg.AddArg("src", src); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | //win::OpenWindow("dev:xpage[BigPicture.vx]",arg); |
| | | |
| | | int h = openUrl("/sale/view/ProductLibrary/xpage/bigpictureview", arg); |
| | | return 1; |
| | | |
| | | xwin x = new xwin; |
| | | x.setNativePointer(h); |
| | | m_winHwnd = x.GetHWND(); |
| | | |
| | | string sh = doc.GetXml(); |
| | | int p = cast(sh as int); |
| | | win32::SendMessage(m_winHwnd, 0x401, p, 0); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | if (comdid == "xmSave") |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | string x = " ".space(256); |
| | | xutil::OpenDialog(this.GetHWND(), x); |
| | | if (x == "") return 0; |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | msxml::IXMLDOMElement e = doc.GetXmlDoc().selectSingleNode("ImageList"); |
| | | msxml::IXMLDOMNodeList nlist = e.SelectNodes("image"); |
| | | |
| | | int hCursor = xutil::SetCursorWait(); |
| | | int s = nlist.length; |
| | | string result = ""; |
| | | for (int i = 0; i < s; i++) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | msxml::IXMLDOMElement xitem = nlist.item(i); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | if (picname == "") continue; |
| | | string goodsno = xitem.selectSingleNode("GoodsNo").text; |
| | | string src = picname.mid(26, picname.length()); |
| | | //trace(picname + "-->" + src + "\r\n"); |
| | | if (src == "" || src == "/") continue; |
| | | int openRet = xaserver::DownLoadFile(GetServerUrl(), "/business/products/chanpin/" + src, "", x + "/" + goodsno + ".jpg"); |
| | | if (openRet < 0) |
| | | { |
| | | //trace(picname + "-->" + src + "\r\n"); |
| | | result += goodsno + " "; |
| | | } |
| | | } |
| | | xutil::RestoreCursor(hCursor); |
| | | if (result != "") |
| | | alert(result + "\r\n以上货号下载图片失败!"); |
| | | else |
| | | alert("保存完毕!"); |
| | | } |
| | | else if (comdid == "xmDelete") |
| | | { |
| | | int hh = ParentHWND; |
| | | if (hh > 0) |
| | | { |
| | | int nIndex = im.GetSelectIndex(); |
| | | if (nIndex < 0 || nIndex >= im.GetImageCount()) return 0; |
| | | im.RemoveImage(nIndex); |
| | | im.Redraw(); |
| | | string comd = "Delete:" + nIndex.toString(); |
| | | win32::SendMessage(hh, 0x401, comd, 0); |
| | | } |
| | | } |
| | | |
| | | return 0; |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | int OnCombboChange(ref TCommandEvent evt, int lParam) |
| | | { |
| | | xcombobox xc = GetControl("precent"); |
| | | string text = xcombobox::GetLBText(xc.GetId()); |
| | | int p = text.toInt(); |
| | | if (p == 0) p = 100; |
| | | im.Preview(p); |
| | | return 1; |
| | | } |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | int OnAttachEvent() |
| | | { |
| | | AttachEvent("im1", "IMG_LDBCLICK", OnImgDBClicked); |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | AttachEvent("precent", "CBN_SELCHANGE", OnCombboChange); |
| | | } |
| | | |
| | | }; |
| | | int init() |
| | | { |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg = new xaserverarg; |
| | | |
| | | if (this.GetParam()) |
| | | arg = this.GetParam(); |
| | | else |
| | | return 0; |
| | | |
| | | if (url::get(GetEntityName(1) + "/pref/category/picture/list", arg.GetString(), x) != 1) |
| | | { |
| | | trace("xxx", x.GetXml()); |
| | | return 0; |
| | | } |
| | | //trace(arg.GetString()); |
| | | //trace(x.GetXml()); |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | im = GetControl("im1"); |
| | | OnAttachEvent(); |
| | | |
| | | ParentHWND = 0; |
| | | |
| | | if (this.GetParam()) |
| | | { |
| | | xaserverarg arg = new xaserverarg; |
| | | //arg.setNativePointer(arg.CreateInstance()); |
| | | arg = this.GetParam(); |
| | | string hh = arg.GetArgString("ParentHWND"); |
| | | ParentHWND = hh.toInt(); |
| | | string openflag = arg.GetArgString("OpenFlag"); |
| | | //alert(openflag); |
| | | if (openflag != "0") hiddenBox("xmDelete", false); |
| | | //trace(arg.GetString()); |
| | | xml x = new xml; |
| | | x.setNativePointer(xml::CreateInstance()); |
| | | //alert(arg.GetString()); |
| | | //if(url::get("/sale/data/product/pref/category/picture/list",arg.GetString(),x)!=1) |
| | | if (url::get("/sale/data/ProductLibrary3/pref/picture/imagelistSKUNoList", arg.GetString(), x) != 1) |
| | | { |
| | | trace("xxx", x.GetXml()); |
| | | return 0; |
| | | } |
| | | doc = x; |
| | | //alert(x.GetXml()); |
| | | msxml::IXMLDOMElement e = x.GetXmlDoc().selectSingleNode("ImageList"); |
| | | msxml::IXMLDOMNodeList nlist = e.SelectNodes("image"); |
| | | int i; |
| | | int s = nlist.length; |
| | | for (i = 0; i < s; i++) |
| | | { |
| | | msxml::IXMLDOMElement xitem = nlist.item(i); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | string goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | //trace(picname + "\r\n"); |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, goodno); |
| | | } |
| | | im.Redraw(); |
| | | } |
| | | else { |
| | | im.AddImages("/business/products/chanpin/BL-002/291679.jpg", "x1"); |
| | | im.AddImages("/business/products/chanpin/BL-002/291759.jpg", "x2"); |
| | | im.AddImages("/business/products/chanpin/BL-002/417884.jpg", "x3"); |
| | | im.Redraw(); |
| | | } |
| | | win32::SetFocus(im.GetId()); |
| | | |
| | | string userno = xaserver::GetUserNo(); |
| | | /*if(userno == "1003" || userno == "1137" || userno == "admin") { |
| | | //hiddenBox(); |
| | | } else { |
| | | hiddenBox("xmSave", false); |
| | | }*/ |
| | | hiddenBox("xmSave", false); |
| | | |
| | | return -1; |
| | | } |
| | | }; |
| | | ] |
| | |
| | | #include <wobject/xstring.hpp> |
| | | #include <xcontrol/xtreeview.hpp> |
| | | #include <xcontrol/xdwgrid.hpp> |
| | | use "xcontrol.vframe.vbusiness.vd" |
| | | use "xbase.vframe.vbusiness.vd" |
| | | use "multi.vbind.vbind.wface.vd" |
| | | use "productlibrary.vd" |
| | | use "shoppingcart.vd" |
| | | |
| | | #include "vbusiness/vframe/listwin.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | |
| | | using xml = KXMLDOMDocument; |
| | | class __declspec(dllexport) listSupplierv3 : public listwin |
| | | { |
| | | public: |
| | | xdwgrid dw_goods; |
| | | xtreeview tv_1; |
| | | xcombobox ddlb_1; |
| | | int changeddlb; |
| | | xstring TypeWork; |
| | | xstring GoodsUrl; |
| | | xstring m_sType; //type |
| | | xstring m_sTypeTxt; //选中树的data |
| | | // xstring m_searchtxt; |
| | | int PIndex; |
| | | xnode m_agentNode; //Agent Condition |
| | | xstring m_agentCond; //Agent Node |
| | | |
| | | public: |
| | | listSupplierv3(void* implPtr, HWND hWnd) :listwin(implPtr, hWnd) {} |
| | | public: |
| | | static listSupplierv3* CreateInstance(void* implPtr, void* hWnd) |
| | | unit trade |
| | | [ |
| | | class ViewPictures : public frame |
| | | { |
| | | listSupplierv3* pWin = new listSupplierv3(implPtr, (HWND)hWnd); |
| | | return pWin; |
| | | } |
| | | int OnRetrieve() |
| | | { |
| | | xml x; |
| | | msxml::IXMLDOMElement imageElement; |
| | | string m_customer; |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"pageindex", xstring(PIndex)); //第几页 |
| | | arg.AddArg(L"pagenumber", xstring(listwin::m_pageNumber)); //每页数量 |
| | | arg.AddArg(L"QueryTxt", listwin::m_QueryTxt); |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | //alert(L"xxxx"); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int OnCmdDispatch(string comdid) |
| | | { |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | if (comdid == "xmClose") |
| | | { |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | CloseWindow(); |
| | | return 1; |
| | | } |
| | | //alert(x.GetXml()); |
| | | dw_list.Retrieve(x); |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | return 0; |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int SetEntityData(xaserverarg arg) |
| | | { |
| | | xstring strQueryTxt = arg.GetArgString(L"QueryTxt"); |
| | | xml x; |
| | | |
| | | arg.AddArg(L"sType", m_sType); |
| | | arg.AddArg(L"sTypeTxt", m_sTypeTxt); |
| | | trace(arg.GetString()); |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/list", arg.GetString(), x) != 1) |
| | | int OnXCommand(ref TXCommandEvent evt, int p) |
| | | { |
| | | alert(x.text()); |
| | | |
| | | return -1; |
| | | return OnCmdDispatch(evt.pStrID); |
| | | } |
| | | else |
| | | |
| | | int OnAttachEvent() |
| | | { |
| | | KXMLDOMElement e = x.documentElement(); |
| | | if (listwin::dw_pages && e.selectSingleNode(L"@TotalPage")) |
| | | AttachEvent("WM_XCOMMAND", OnXCommand); |
| | | return 1; |
| | | } |
| | | |
| | | int OnShowImage(string skuid) |
| | | { |
| | | imageview im = GetControl("im1"); |
| | | //im.RemoveImage(); |
| | | im.ResetEx(); |
| | | |
| | | xml xp = new xml; |
| | | xp.setNativePointer(xml::CreateInstance()); |
| | | xaserverarg arg_pic = new xaserverarg; |
| | | arg_pic.setNativePointer(arg_pic.CreateInstance()); |
| | | arg_pic.AddArg("SKUID", skuid); |
| | | if (url::get("/sale/data/ProductLibrary3/pref/picture/imagelistSKU", arg_pic.GetString(), xp) != 1) |
| | | { |
| | | |
| | | xstring s = e.selectSingleNode(L"@TotalPage").text(); //总数量 |
| | | listwin::dw_pages.SetMaxPage(s.toInt()); |
| | | trace("xxx", xp.GetXml()); |
| | | } |
| | | //trace(x.GetXml()); |
| | | listwin::dw_list.Retrieve(x); |
| | | listwin::dw_list.Redraw(); |
| | | listwin::dw_list.SetReadOnly(true); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnChangePages(TEvent* evt, LPARAM p) |
| | | { |
| | | PAGENMHDR* h = (PAGENMHDR*)evt->notify.pnmh; |
| | | int c = h->cur; |
| | | |
| | | |
| | | HCURSOR hCursor = xutil::SetCursorWait(); |
| | | OnRetrieve(); |
| | | PIndex = c; |
| | | xutil::RestoreCursor(hCursor); |
| | | return 1; |
| | | |
| | | |
| | | } |
| | | |
| | | int ViewUpdate(int pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | if (updateItem == L"refresh") |
| | | { |
| | | //trace(L"sd"); |
| | | xdwpages zz = GetControl(L"pages"); |
| | | int h = zz.SetCurPage(1); |
| | | //trace(h); |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | //树选择 |
| | | int OnTreeSelChanged(TEvent evt, LPARAM p) |
| | | { |
| | | if (changeddlb != 1) |
| | | { |
| | | //alert(L"1"); |
| | | |
| | | HTREEITEM h = tv_1.GetSelectedItem(); |
| | | KXMLDOMElement& e = *(KXMLDOMElement*)tv_1.GetItemData(h); |
| | | |
| | | xstring t = e.selectSingleNode(L"@type").text(); |
| | | m_sType = t + L""; |
| | | xstring txt = e.selectSingleNode(L"@code").text(); |
| | | if (txt == L"") |
| | | txt = e.selectSingleNode(L"@name").text(); |
| | | m_sTypeTxt = txt + L""; |
| | | |
| | | //alert(m_sTypeTxt); |
| | | |
| | | PIndex = 1; |
| | | OnRetrieve(); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int createSubTree(HTREEITEM h, KXMLDOMElement ele) |
| | | { |
| | | KXMLDOMNodeList nlist = ele.selectNodes(L"item"); |
| | | int i; |
| | | int s = nlist.length(); |
| | | if (s > 0) |
| | | for (i = 0; i < s; i++) |
| | | else |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(h, name, (LPARAM)e, 15); |
| | | createSubTree(hw, *e); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnCreateTree(xstring sType) |
| | | { |
| | | |
| | | while (tv_1.GetRootItem()) |
| | | tv_1.DeleteItem(tv_1.GetRootItem()); |
| | | |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"sType", sType); |
| | | //Tree.pref.supplier.xq |
| | | //getUrl(GetEntityName(1)+L"/entity/list",arg.GetString(),x); |
| | | //if (xaserver::ExecXQuery(GetServerUrl(),L"[Tree.pref.supplier.xq]",arg.GetString(),x)!=1) |
| | | if (getUrl(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/pref/list/tree", arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"root/item"); |
| | | int len = nlist.length(); |
| | | if (len > 0) |
| | | { |
| | | int i; |
| | | for (i = 0; i < len; i++) |
| | | trace(skuid + "===== " + xp.GetXml()); |
| | | imageElement = xp.GetXmlDoc().documentElement; |
| | | msxml::IXMLDOMNodeList nlistp = xp.GetXmlDoc().selectNodes("ImageList/image"); |
| | | int lenp = nlistp.length; |
| | | for (int ip = 0; ip < lenp; ip++) |
| | | { |
| | | |
| | | KXMLDOMElement* e = new KXMLDOMElement(nlist.item(i)); |
| | | xstring name = e->selectSingleNode(L"@name").text(); |
| | | HTREEITEM hw = tv_1.InsertChildItem(0, name, (LPARAM)e, 15); |
| | | |
| | | createSubTree(hw, *e); |
| | | tv_1.ExpandItem(hw); |
| | | msxml::IXMLDOMElement xitem = nlistp.item(ip); |
| | | string picname = xitem.selectSingleNode("PicPath").text; |
| | | string goodno = xitem.selectSingleNode("GoodsNo").text; |
| | | if (picname == "/business/products/Thumbs//") |
| | | picname = "/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg"; |
| | | im.AddImages(picname, ""); |
| | | } |
| | | tv_1.ExpandItem(0); |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //xcombobox下拉 |
| | | int OnSelectDdlb(TEvent evt, LPARAM p) |
| | | { |
| | | changeddlb = 1; |
| | | |
| | | int CB_GETCURSEL = 0x0147; |
| | | int nIndex = SendMessageW(ddlb_1.GetHWND(), CB_GETCURSEL, 0, 0); |
| | | KXMLDOMElement e = ddlb_1.GetElement();//GetitemData(wid,nIndex);//ddlb_1.GetElement(); |
| | | KXMLDOMElement e2 = e.selectSingleNode(L"item[" + xstring((nIndex + 1)) + L"]"); |
| | | xstring text = e2.selectSingleNode(L"@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) { |
| | | //win::MessageBox(GetHWND(),L"请选中要删除的行!",L"提示",0); |
| | | return -1; |
| | | } |
| | | } |
| | | |
| | | KXMLDOMElement e = listwin::dw_list.GetRowElement(row); |
| | | //xstring sguid = e.SelectSingleNode(L"@guid").text; |
| | | //xstring sName = e.selectSingleNode(L"Name").text+L""; |
| | | xstring sguid = dw_list.GetItemString(dw_list.GetRow(), L"SupplierID"); |
| | | xstring sName = dw_list.GetItemString(dw_list.GetRow(), L"Name"); |
| | | int MB_YESNO = 0x00000004; |
| | | int IDYES = 6; |
| | | if (MessageBoxW(GetHWND(), L"确认要删除供应商 " + sName + L" 的信息吗?", L"提示", MB_YESNO) != IDYES) return 1; |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"guid", sguid); |
| | | arg.AddArg(L"EntityID", sguid); |
| | | // trace(sguid); |
| | | if (xurl::post(GetServerUrl(), L"/sale/data/" + GetEntityName(1) + L"/entity/delete", arg.GetString(), x) != 1) |
| | | { |
| | | xstring error = x.text(); |
| | | trace(error); |
| | | } |
| | | else |
| | | { |
| | | KXMLDOMElement msg = x.selectNodes(L"process").item(0); |
| | | xstring success = msg.selectSingleNode(L"@finished").text(); |
| | | if (success == L"0") |
| | | { |
| | | alert(msg.selectSingleNode(L"@errInfo").text()); |
| | | } |
| | | else |
| | | { |
| | | MessageBoxW(GetHWND(), L"删除成功!", L"提示", 0); |
| | | listwin::dw_list.DeleteRow(row); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChangedEx(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | //if(row < 1 or row > dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = listwin::dw_list.GetRowElement(row); |
| | | xstring entity = ele.selectSingleNode(L"SupplierID").text(); |
| | | xml x; |
| | | |
| | | xaserverarg arg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"EntityID", entity); |
| | | |
| | | |
| | | xstring no1 = publiccode::GetUser().no; |
| | | if (no1 != L"00201") |
| | | { |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritemEx"; |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | GoodsUrl = L"/sale/data/SupplierV3/entity/supplieritem"; |
| | | } |
| | | if (getUrl(GetServerUrl(), GoodsUrl, arg.GetString(), x) != 1) |
| | | { |
| | | trace(x.text()); |
| | | return -1; |
| | | } |
| | | else |
| | | { |
| | | dw_goods.Retrieve(x); |
| | | dw_goods.Redraw(); |
| | | dw_goods.SetReadOnly(true); |
| | | } |
| | | SetAgent(L"list", entity); |
| | | return 1; |
| | | } |
| | | |
| | | int GridSearch() |
| | | { |
| | | //alert(L"你好"); |
| | | #if 0 |
| | | |
| | | xstring m_config = L"view.Supplier.v3.config"; |
| | | xdwgrid dw = listwin::dw_list; |
| | | xaserverarg& arg = *new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | xstring str = TFile::node(m_config, L"config", L"search"); |
| | | if (str != L"") { |
| | | arg.AddArg(L"sheet", str); |
| | | } |
| | | else |
| | | arg.AddArg(L"sheet", L"dev:sheet[Supplier.v3.tpl/list]"); |
| | | arg.AddArg(L"search", listwin::m_QueryTxt); |
| | | openUrl(L"view.dlg.vface/xpage/grid/column/search", &arg); |
| | | xstring ok = arg.GetArgString(L"return"); |
| | | if (ok == L"ok") { |
| | | xstring txt = arg.GetArgString(L"search"); |
| | | if (txt != L"") { |
| | | listwin::m_QueryTxt = txt; |
| | | //trace(txt); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | #endif |
| | | return 0; |
| | | } |
| | | |
| | | 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(TEvent evt, LPARAM p) |
| | | { |
| | | return 1; |
| | | } |
| | | int OnLogOff() |
| | | { |
| | | return 1; |
| | | } |
| | | int OnChecked() |
| | | { |
| | | xstring partyno = dw_list.GetItemString(dw_list.GetRow(), L"PartyNo"); |
| | | if (partyno.find(L"N") < 0) |
| | | { |
| | | alert(L"已经是正式供应商"); |
| | | return 0; |
| | | } |
| | | xstring entityid = GetEntityID(dw_list.GetRow()); |
| | | int MB_OKCANCEL = 1; |
| | | int IDOK = 1; |
| | | int ret = MessageBoxW(GetHWND(), L"是否转成正式供应商?", L"提示", MB_OKCANCEL); |
| | | if (ret == IDOK) |
| | | { |
| | | xml x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/updateno", L"entityid", entityid); |
| | | |
| | | if (xstring(x.xml()).find(L"success") > 0) |
| | | { |
| | | alert(L"处理成功"); |
| | | OnRetrieve(); |
| | | } |
| | | } |
| | | return 1; |
| | | } |
| | | int PreOnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | |
| | | if (comdid.find(L"action:LogOff", 0) >= 0) return OnLogOff(); |
| | | if (comdid.find(L"action:bill.delete", 0) >= 0) |
| | | { |
| | | OnDeleteRow(); |
| | | return 0; |
| | | } |
| | | if (comdid == L"action:search1") return GridSearch(); |
| | | if (comdid == L"action:bill.refresh") |
| | | { |
| | | return OnRetrieve(); |
| | | } |
| | | if (comdid == L"action:bill.xmSaveAs") |
| | | { |
| | | xstring userno = publiccode::GetUser().no; |
| | | if (userno == L"00701" || userno == L"00601" || userno == L"admin") |
| | | { |
| | | dw_list.SaveAs(L""); |
| | | im.Redraw(); |
| | | //win32::SendMessage(im.GetId(),0x000f,0,1); |
| | | //win32::InvalidateRect(im.GetId(),cast(0 as ref xrect),true); |
| | | } |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.Annex") |
| | | |
| | | int onload() |
| | | { |
| | | xaserverarg& arg = *new xaserverarg; |
| | | OnAttachEvent(); |
| | | xaserverarg arg = new xaserverarg; |
| | | arg.setNativePointer(arg.CreateInstance()); |
| | | arg.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | arg.AddArg(L"ApplyStatus", dw_list.GetItemString(dw_list.GetRow(), L"ApplyStatus")); |
| | | |
| | | OpenWindow(L"dev:xpage[maint.Document.Supplier.v3.vx]", (LPARAM)&arg); |
| | | int p = GetParam(); |
| | | arg.setNativePointer(p); |
| | | string skuid = arg.GetArgString("guid"); |
| | | string customerItemNo = arg.GetArgString("CustomerItemNo"); |
| | | OnShowImage(skuid); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.AnnexEx") |
| | | { |
| | | xaserverarg& arg4 = *new xaserverarg; |
| | | arg4.setNativePointer(arg4.CreateInstance()); |
| | | arg4.AddArg(L"entityid", dw_list.GetItemString(dw_list.GetRow(), L"SupplierID")); |
| | | //arg4.AddArg(L"ApplyStatus",dw_list.GetItemString(dw_list.GetRow(),L"ApplyStatus")); |
| | | |
| | | //OpenWindow(L"dev:xpage[maint.Document.Customer.v3.vx]", p4); |
| | | OpenWindow(L"dev:xpage[maint.Document.SupplierSD.v3.vx]", (LPARAM)&arg4); |
| | | return 1; |
| | | } |
| | | if (comdid == L"action:bill.checked") |
| | | return OnChecked(); |
| | | // if(comdid==L"action:bill.import") return OnImport(); |
| | | // if(comdid.find(L"action:",0)>=0) return ProcessFlowAction(comdid,1); |
| | | //if(comdid==L"search") return GridSearch(L"view.dlg.vface/xpage/grid/column/edit"); |
| | | //if(comdid==L"showall") return ShowAll(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int PostOnAttachEvent() |
| | | { |
| | | //获得树的选择事件 |
| | | AttachEvent(L"tv_1", L"TVN_SELCHANGED", (FEvent)&listSupplierv3::OnTreeSelChanged); |
| | | AttachEvent(L"cbx_1", L"CBN_SELCHANGE", (FEvent)&listSupplierv3::OnSelectDdlb); |
| | | AttachEvent(L"pages", L"PAGE_CLICK", (FEvent)&listSupplierv3::OnChangePages); |
| | | AttachEvent(L"dw_list", L"DWV_RCLICKED", (FEvent)&listSupplierv3::OnRClick);//鼠标右键 |
| | | //AttachEvent(L"dw_list", L"DWV_DOUBLECLICKED", (FEvent)&listSupplierv3::OnDoubleClicked); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | PIndex = 1; |
| | | listwin::m_QueryTxt = L""; //查询条件 |
| | | m_sType = L""; //type |
| | | m_sTypeTxt = L""; //选中树的data |
| | | |
| | | listwin::onload(); |
| | | |
| | | tv_1 = GetControl(L"tv_1"); |
| | | ddlb_1 = GetControl(L"cbx_1"); |
| | | |
| | | changeddlb = 0; |
| | | OnCreateTree(L"GoodsCates"); |
| | | dw_list.SetColumnState(L"SupplierID", false); |
| | | dw_list.SetColumnState(L"userNo", false); |
| | | dw_list.SetColumnState(L"YearEstablished", false); |
| | | dw_list.SetColumnState(L"LegalPerson", false); |
| | | dw_list.SetColumnState(L"ThirdPartyReport", false); |
| | | dw_list.SetColumnState(L"bAddress", false); |
| | | dw_list.SetColumnState(L"PayType", false); |
| | | dw_list.SetColumnState(L"PicPath", false); |
| | | dw_list.SetColumnState(L"SDID", false); |
| | | dw_list.SetColumnState(L"AdvantageProduct", false); |
| | | //dw_list.SetColumnState(L"ApplyStatus",false); |
| | | |
| | | dw_goods = GetControl(L"dw_goods"); |
| | | dw_goods.openUrl(GetServerUrl(), L"/sale/view/SupplierV3/template/supplier/supplieritem"); |
| | | |
| | | if (publiccode::GetUser().name != L"admin") |
| | | { |
| | | xstring s = publiccode::GetUser().id; |
| | | |
| | | xml supplier_x = ViewObject::RetrieveData(GetServerUrl(), L"/sale/data/SupplierV3/entity/FindBySaleType", L"id", s); |
| | | if (supplier_x) |
| | | { |
| | | TypeWork = supplier_x.text(); |
| | | |
| | | if (TypeWork.find(L"采购") >= 0) |
| | | { |
| | | |
| | | dw_list.SetColumnState(L"DateEx", false); |
| | | dw_list.SetColumnState(L"DateExS", false); |
| | | dw_list.SetColumnState(L"Name", false); |
| | | dw_list.SetColumnState(L"ProvinceCode", false); |
| | | dw_list.SetColumnState(L"City", false); |
| | | dw_list.SetColumnState(L"District", false); |
| | | dw_list.SetColumnState(L"Address", false); |
| | | dw_list.SetColumnState(L"CName", false); |
| | | dw_list.SetColumnState(L"TEL", false); |
| | | dw_list.SetColumnState(L"Mob", false); |
| | | dw_list.SetColumnState(L"AreaCode", false); |
| | | dw_list.SetColumnState(L"Fax", false); |
| | | dw_goods.SetColumnState(L"Price", false); |
| | | dw_goods.SetColumnState(L"PackRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PartRMBPrice", false); |
| | | dw_goods.SetColumnState(L"PaperRMBPrice", false); |
| | | dw_goods.SetColumnState(L"ETD", false); |
| | | dw_goods.SetColumnState(L"InvoiceNo", false); |
| | | |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&listSupplierv3::OnRowChangedEx); |
| | | |
| | | listwin::onloaded(); |
| | | xstring EntityID; |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = listwin::m_configDoc.selectSingleNode(L"//entity/EntityID[1]").text(); |
| | | if (ele.selectSingleNode(id)) |
| | | EntityID = ele.selectSingleNode(id).text(); |
| | | listwin::SetAgent(L"list", EntityID); |
| | | return 1; |
| | | } |
| | | |
| | | }; |
| | | }; |
| | | ] |