|  |  | 
 |  |  |    xdwgrid   dwc_list; | 
 |  |  |  | 
 |  |  |    //产品缓存对象 | 
 |  |  |    xdataset g_xdoc_product; | 
 |  |  |    xdataset g_xdoc_shoppingcart; | 
 |  |  |    //xdataset g_xdoc_product; | 
 |  |  |    //xdataset g_xdoc_shoppingcart; | 
 |  |  |  | 
 |  |  |    xcombobox  cbx_goodscar; | 
 |  |  |    //是否多选 | 
 |  |  | 
 |  |  |    KXMLDOMElement imageElement; | 
 |  |  |    xstring m_customer; | 
 |  |  |  | 
 |  |  | public: | 
 |  |  |    ProductLibrary4Win(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} | 
 |  |  | public: | 
 |  |  |    static ProductLibrary4Win* CreateInstance(void* implPtr, void* hWnd) | 
 |  |  |    { | 
 |  |  |       ProductLibrary4Win* pWin = new ProductLibrary4Win(implPtr, (HWND)hWnd); | 
 |  |  |       return pWin; | 
 |  |  |    } | 
 |  |  | public: | 
 |  |  |    int FillGoodsCarList() | 
 |  |  |    { | 
 |  |  | 
 |  |  |    KXMLDOMElement OnGetCarListRowElement(int row = 0) | 
 |  |  |    { | 
 |  |  |       if (row < 1) row = dwc_list.GetRow(); | 
 |  |  |       if (row < 1 || row > dwc_list.GetRowCount()) return 0; | 
 |  |  |       KXMLDOMElement e = g_xdoc_shoppingcart.getRowElement(L"data/Item", row); | 
 |  |  |       if (row < 1 || row > dwc_list.GetRowCount()) return KXMLDOMElement(); | 
 |  |  |       KXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |       return e; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | 
 |  |  |       xs.SetContent(html); | 
 |  |  |       xs.Redraw(); | 
 |  |  |  | 
 |  |  |       xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |       xstring id = dw_list.GetGuid(row); | 
 |  |  |       OnShowImage(id); | 
 |  |  |       trace(id); | 
 |  |  |       return 1; | 
 |  |  | 
 |  |  |       xs.Redraw(); | 
 |  |  |       if (m_customer) | 
 |  |  |       { | 
 |  |  |          xstring id = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); | 
 |  |  |          xstring customerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); | 
 |  |  |          xstring id = dw_list.GetItemString(row, L"SKUID"); | 
 |  |  |          xstring customerItemNo =dw_list.GetItemString( row, L"CustomerItemNo"); | 
 |  |  |          OnShowImage(id, customerItemNo); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  | 
 |  |  |       int MB_OKCANCEL = 1; | 
 |  |  |       int MB_ICONQUESTION = 32; | 
 |  |  |       if (MessageBoxW(GetHWND(), L"确认删除指定的项,删除后将不能恢复?", L"提示", MB_OKCANCEL | MB_ICONQUESTION) != IDOK) return 1; | 
 |  |  |       xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |       xstring id = dw_list.GetGuid(row); | 
 |  |  |  | 
 |  |  |       if (ProductLibraryView::DeleteItem(id) == 1)   dw_list.DeleteRow(0); | 
 |  |  |       return 1; | 
 |  |  | 
 |  |  |  | 
 |  |  |    xstring makeHtml(int row) | 
 |  |  |    { | 
 |  |  |       xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |       xstring id = dw_list.GetItemString(row, L"@guid"); | 
 |  |  |       xml x = GetGoodsPropList(id); | 
 |  |  |       xml x1 = GetGoodsPropListEx(id); | 
 |  |  |  | 
 |  |  | 
 |  |  |          { | 
 |  |  |             name = fieldsEx.item(i).selectSingleNode(L"@name").text(); | 
 |  |  |             label = fieldsEx.item(i).selectSingleNode(L"@label").text(); | 
 |  |  |             ls_item += L"<td>" + label + L"</td>" + L"<td style='text-align:center'>" + g_xdoc_product.getData(0, L"data/Item", row, name) + L"</td>"; | 
 |  |  |             ls_item += L"<td>" + label + L"</td>" + L"<td style='text-align:center'>" + dw_list.GetItemString( row, (LPCTSTR)name) + L"</td>"; | 
 |  |  |             cnt++; | 
 |  |  |             i++; | 
 |  |  |             if (i == len)break; | 
 |  |  | 
 |  |  |                if (i >= len)count = 2; | 
 |  |  |                continue; | 
 |  |  |             } | 
 |  |  |             else if (g_xdoc_product.getData(0, L"data/Item", row, name) == L"") | 
 |  |  |             else if (dw_list.GetItemString( row, (LPCTSTR)name) == L"") | 
 |  |  |             { | 
 |  |  |                KXMLDOMNodeList options = fields.item(i).selectNodes(L"item"); | 
 |  |  |                int tlen = options.length(); | 
 |  |  | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                ls_item = L"<td>" + label + L"</td>" + L"<td>" + g_xdoc_product.getData(0, L"data/Item", row, name) + L"</td>"; | 
 |  |  |                ls_item = L"<td>" + label + L"</td>" + L"<td>" + dw_list.GetItemString( row, (LPCTSTR)name) + L"</td>"; | 
 |  |  |                count++; | 
 |  |  |             } | 
 |  |  |             i++; | 
 |  |  | 
 |  |  |          html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString(row, L"PackTerm") + L"</span></div>"; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       if (g_xdoc_product.getData(0, L"data/Item", row, L"Remark") != L"") | 
 |  |  |       if (dw_list.GetItemString( row, L"Remark") != L"") | 
 |  |  |       { | 
 |  |  |          //html +=  L"<div style='height:12px'/>"; | 
 |  |  |          html += L"<div ><span style='font-weight:700;width:50;font-size:10pt'  >备注:</span></div>"; | 
 |  |  |          html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + g_xdoc_product.getData(0, L"data/Item", row, L"Remark") + L"</span></div>"; | 
 |  |  |          html += L"<div ><span style='margin-left:8px;margin-right:16px;font-weight:400;font-size:10pt' >" + dw_list.GetItemString( row, L"Remark") + L"</span></div>"; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       html += L"<div style='height:24px'/>"; | 
 |  |  | 
 |  |  |          if (i == 0) | 
 |  |  |             html += L"<td rowspan='" + xstring(len) + L"'>" + No + L"</td><td >" + label + L"</td><td >" + L"</td>"; | 
 |  |  |          else | 
 |  |  |             html += L"<td >" + label + L"</td><td >" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, name) + L"</td>"; | 
 |  |  |             html += L"<td >" + label + L"</td><td >" +dw_list.GetItemString( row, (LPCTSTR)name) + L"</td>"; | 
 |  |  |          html += L"</tr>"; | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       html += L"<tr>"; | 
 |  |  |       html += L"<td rowspan='3'>" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"PackCode") + L"</td><td >包装方式</td><td >" + | 
 |  |  |          g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CPack") + L"</td>"; | 
 |  |  |       html += L"<td rowspan='3'>" +dw_list.GetItemString( row, L"PackCode") + L"</td><td >包装方式</td><td >" + | 
 |  |  |          dw_list.GetItemString(row, L"CPack") + L"</td>"; | 
 |  |  |       html += L"</tr>"; | 
 |  |  |       html += L"<tr height='48'>"; | 
 |  |  |       html += L"<td >包装要求</td><td >" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"PackQualityTerm") + L"</td>"; | 
 |  |  |       html += L"<td >包装要求</td><td >" +dw_list.GetItemString( row, L"PackQualityTerm") + L"</td>"; | 
 |  |  |       html += L"</tr>"; | 
 |  |  |       html += L"<tr>"; | 
 |  |  |       html += L"<td >侧唛</td><td ></td>"; | 
 |  |  |       html += L"</tr>"; | 
 |  |  |  | 
 |  |  |       html += L"<tr height='72'>"; | 
 |  |  |       html += L"<td>" + g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"QualityCode") + L"</td><td >质量要求</td><td >" + | 
 |  |  |          g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"QualityTerm") + L"</td>"; | 
 |  |  |       html += L"<td>" +dw_list.GetItemString( row, L"QualityCode") + L"</td><td >质量要求</td><td >" + | 
 |  |  |          dw_list.GetItemString(row, L"QualityTerm") + L"</td>"; | 
 |  |  |       html += L"</tr>"; | 
 |  |  |  | 
 |  |  |       html += L"</table>"; | 
 |  |  | 
 |  |  |       if (row < 1) row = dw_list.GetRow(); | 
 |  |  |       if (row < 1 || row > dw_list.GetRowCount()) return 0; | 
 |  |  |  | 
 |  |  |       KXMLDOMElement e = g_xdoc_product.getRowElement(L"data/Item", row); | 
 |  |  |       xstring skuid = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |       xstring SKUNo = g_xdoc_product.getData(0, L"data/Item", row, L"SKUNo"); | 
 |  |  |       KXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |       xstring skuid = dw_list.GetItemString( row, L"@guid"); | 
 |  |  |       xstring SKUNo = dw_list.GetItemString( row, L"SKUNo"); | 
 |  |  |       xstring id = ViewObject::GetGuid(); | 
 |  |  |       xstring ret1 = Up(id); | 
 |  |  |       if (ret1 == L"-1") return -1; | 
 |  |  | 
 |  |  |       // 图片名加入数据库 | 
 |  |  |       xml x ; | 
 |  |  |       x.loadXML(L"<Item update.new='1' update.modify='1' guid='" + id + L"'>" + | 
 |  |  |          "<ProductPictureID>" + id + L"</ProductPictureID>" + | 
 |  |  |          "<OriginFile>" + originfile + L"</OriginFile>" + | 
 |  |  |          "<FileExt>" + ext + L"</FileExt>" + | 
 |  |  |          "<SKUID>" + skuid + L"</SKUID>" + | 
 |  |  |          "<Name>[" + SKUNo.trim() + L"]</Name>" + | 
 |  |  |          "<FileName>" + id + L".jpg</FileName>" + | 
 |  |  |          "</Item>" | 
 |  |  |          L"<ProductPictureID>" + id + L"</ProductPictureID>" + | 
 |  |  |          L"<OriginFile>" + originfile + L"</OriginFile>" + | 
 |  |  |          L"<FileExt>" + ext + L"</FileExt>" + | 
 |  |  |          L"<SKUID>" + skuid + L"</SKUID>" + | 
 |  |  |          L"<Name>[" + SKUNo.trim() + L"]</Name>" + | 
 |  |  |          L"<FileName>" + id + L".jpg</FileName>" + | 
 |  |  |          L"</Item>" | 
 |  |  |       ); | 
 |  |  |  | 
 |  |  |       xaserverarg arg; | 
 |  |  | 
 |  |  |       if (row < 1) row = dwc_list.GetRow(); | 
 |  |  |       if (row < 1 || row > dwc_list.GetRowCount()) return 0; | 
 |  |  |  | 
 |  |  |       KXMLDOMElement e = g_xdoc_shoppingcart.getRowElement(L"data/Item", row); | 
 |  |  |       xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); | 
 |  |  |       xstring SKUNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID/@__displaystring"); | 
 |  |  |       KXMLDOMElement e = dw_list.GetRowElement( row); | 
 |  |  |       xstring skuid =dw_list.GetItemString( row, L"SKUID"); | 
 |  |  |       xstring SKUNo =dw_list.GetItemString( row, L"SKUID/@__displaystring"); | 
 |  |  |       xstring CustomerID = m_customer; | 
 |  |  |       xstring CustomerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); | 
 |  |  |       xstring CustomerItemNo =dw_list.GetItemString( row, L"CustomerItemNo"); | 
 |  |  |       xstring id = ViewObject::GetGuid(); | 
 |  |  |       xstring ret1 = Up(id); | 
 |  |  |       if (ret1 == L"-1") return -1; | 
 |  |  | 
 |  |  |  | 
 |  |  |       int MB_OKCANCEL = 0x00000001; | 
 |  |  |       int IDOK = 1; | 
 |  |  |       if (win32::MessageBox(GetHWND(), L"确认删除当前图片?", L"提示", MB_OKCANCEL) != IDOK) return 1; | 
 |  |  |       if (MessageBox(GetHWND(), L"确认删除当前图片?", L"提示", MB_OKCANCEL) != IDOK) return 1; | 
 |  |  |  | 
 |  |  |       xstring id = images.item(index).selectSingleNode(L"@guid").text; | 
 |  |  |       xstring id = images.item(index).selectSingleNode(L"@guid").text(); | 
 |  |  |  | 
 |  |  |       xml x = new xml; | 
 |  |  |       x.setNativePointer(xml::CreateInstance()); | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       xml x ; | 
 |  |  |       xaserverarg arg; | 
 |  |  | 		 | 
 |  |  |       xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; | 
 |  |  |       arg.AddArg(L"content", str); | 
 |  |  |       if (url::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) | 
 |  |  |       if (xurl::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) | 
 |  |  |       { | 
 |  |  |          alert(x.text); | 
 |  |  |          alert(x.text()); | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |       if (count == 1) | 
 |  |  | 
 |  |  |          dwc_list.Redraw(); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID"); | 
 |  |  |       xstring SKUNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"SKUID/@__displaystring"); | 
 |  |  |       xstring skuid =dw_list.GetItemString( row, L"SKUID"); | 
 |  |  |       xstring SKUNo =dw_list.GetItemString( row, L"SKUID/@__displaystring"); | 
 |  |  |       xstring CustomerID = m_customer; | 
 |  |  |       xstring CustomerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", row, L"CustomerItemNo"); | 
 |  |  |       xstring CustomerItemNo =dw_list.GetItemString( row, L"CustomerItemNo"); | 
 |  |  |       OnShowImage(skuid, CustomerItemNo); | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  | 
 |  |  |       if (count < 1) return 1; | 
 |  |  |  | 
 |  |  |       KXMLDOMNodeList images = imageElement.selectNodes(L"image"); | 
 |  |  |       int length = images.length; | 
 |  |  |       int length = images.length(); | 
 |  |  |       if (length < index) return 1; | 
 |  |  |  | 
 |  |  |       int MB_OKCANCEL = 0x00000001; | 
 |  |  |       int IDOK = 1; | 
 |  |  |       if (win32::MessageBox(GetHWND(), L"确认删除当前图片?", L"提示", MB_OKCANCEL) != IDOK) return 1; | 
 |  |  |       if (MessageBox(GetHWND(), L"确认删除当前图片?", L"提示", MB_OKCANCEL) != IDOK) return 1; | 
 |  |  |  | 
 |  |  |       xstring id = images.item(index).selectSingleNode(L"@guid").text; | 
 |  |  |       xstring id = images.item(index).selectSingleNode(L"@guid").text(); | 
 |  |  |  | 
 |  |  |       xml x = new xml; | 
 |  |  |       x.setNativePointer(xml::CreateInstance()); | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       xml x; | 
 |  |  |       xaserverarg arg; | 
 |  |  |       xstring str = L"<Item update.modify='1' update.delete='1' guid='" + id + L"'/>"; | 
 |  |  |       arg.AddArg(L"content", str); | 
 |  |  |       if (url::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) | 
 |  |  |       if (xurl::get(L"/sale/data/ProductLibrary/image/update", arg.GetString(), x) != 1) | 
 |  |  |       { | 
 |  |  |          alert(x.text); | 
 |  |  |          alert(x.text()); | 
 |  |  |          return -1; | 
 |  |  |       } | 
 |  |  |       if (count == 1) | 
 |  |  | 
 |  |  |          dw_list.Redraw(); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       KXMLDOMElement e1 = g_xdoc_product.getRowElement(L"data/Item", row); | 
 |  |  |       KXMLDOMElement e1 = dw_list.GetRowElement(row); | 
 |  |  |       xstring skuid = e1.getAttribute(L"guid"); | 
 |  |  |       OnShowImage(skuid); | 
 |  |  |  | 
 |  |  | 
 |  |  |       int row = dw_list.GetNextSelectRow(1); | 
 |  |  |       if (row < 1) row = dw_list.GetRow(); | 
 |  |  |       if (row < 1 || row > dw_list.GetRowCount()) return 0; | 
 |  |  |       KXMLDOMElement e = g_xdoc_product.getRowElement(L"data/Item", row); | 
 |  |  |       KXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |       //KXMLDOMElement e = dw_list.GetRowElement(row); | 
 |  |  |       //alert(e.xml); | 
 |  |  |       xstring id = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |       xstring id = dw_list.GetItemString( row, L"@guid"); | 
 |  |  |       //alert(id); | 
 |  |  |  | 
 |  |  |       int hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |       xstring categoryid = e1.selectSingleNode(L"@guid").text; | 
 |  |  |       xstring categoryid = e1.selectSingleNode(L"@guid").text(); | 
 |  |  |       //alert(categoryid); | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       arg.AddArg(L"SKUID", id); | 
 |  |  |       arg.AddArg(L"CategoryID", categoryid); | 
 |  |  |       xaserverarg* arg = new xaserverarg; | 
 |  |  |       arg->AddArg(L"SKUID", id); | 
 |  |  |       arg->AddArg(L"CategoryID", categoryid); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |       int pr = trust(arg as int); //g_xdoc_product | 
 |  |  |       OpenWindow(L"dev:xpage[PictureView.Product3.vx]", pr); | 
 |  |  |       OpenWindow(L"dev:xpage[PictureView.Product3.vx]", (LPARAM)arg); | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ItemMaint() | 
 |  |  |    { | 
 |  |  |       int hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       KXMLDOMElement e = tv_folder.GetItemData(hItem); | 
 |  |  |       //xstring no = e.getAttribute(L"no"); | 
 |  |  |       //if(no==L"") return 1; | 
 |  |  |       xstring guid = e.getAttribute(L"guid"); | 
 |  |  |       xaserverarg arg; | 
 |  |  |       //xstring guid = e.getAttribute(L"guid"); | 
 |  |  | 	 | 
 |  |  |  | 
 |  |  |       int row = dw_list.GetNextSelectRow(1); | 
 |  |  |       if (row < 1) row = dw_list.GetRow(); | 
 |  |  |       if (row < 1 || row > dw_list.GetRowCount()) return 0; | 
 |  |  |       xstring guid = dw_list.GetItemString(row, L"@guid"); | 
 |  |  |       if (guid == L"") return 1; | 
 |  |  |       arg.AddArg(L"skuid", guid); | 
 |  |  |  | 
 |  |  |       /* | 
 |  |  |       if(no==L"NP0000FS" || no==L"UP0000FS") | 
 |  |  | 
 |  |  |          OpenWindow(L"dev:xpage[PackSchemaMaint.goodslib.vx]"); | 
 |  |  |       }else | 
 |  |  |       { | 
 |  |  |          int pr = g_xdoc_product; | 
 |  |  |          LPARAM  pr = g_xdoc_product; | 
 |  |  |          OpenWindow(L"dev:xpage[ProductLibraryItemMaint.vx]",pr); | 
 |  |  |       } | 
 |  |  |       */ | 
 |  |  |       //KXMLDOMElement ele = g_xdoc_product.getRowElement(L"data/Item", 1); | 
 |  |  |       //alert(ele.xml); | 
 |  |  |  | 
 |  |  |       int pr = g_xdoc_product; | 
 |  |  |       OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", pr); | 
 |  |  |  | 
 |  |  |       OpenWindow(L"dev:xpage[ProductLibraryItemMaint3.vx]", arg); | 
 |  |  | # | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ItemAdd() | 
 |  |  |    { | 
 |  |  |       int hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       int hTopItem = LookupTopFolder(hItem); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |       xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |  | 
 |  |  |       KXMLDOMElement e = tv_folder.GetItemData(hItem); | 
 |  |  | 
 |  |  |       }*/ | 
 |  |  |       xstring guid = e.getAttribute(L"guid"); | 
 |  |  |       if (guid == L"") return 1; | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       xaserverarg arg; | 
 |  |  | 		 | 
 |  |  |       arg.AddArg(L"guid", e.getAttribute(L"guid")); | 
 |  |  |       if (name == L"个人产品") | 
 |  |  |          arg.AddArg(L"FolderID", e.getAttribute(L"guid")); | 
 |  |  | 
 |  |  |       if (Name == L"") Name = e.getAttribute(L"cname"); | 
 |  |  |       arg.AddArg(L"No", No); | 
 |  |  |       arg.AddArg(L"CName", Name); | 
 |  |  |       int p = arg; | 
 |  |  |       OpenWindow(L"dev:xpage[Quick.Input.NewProduct.vx]", p); | 
 |  |  |       OpenWindow(L"dev:xpage[Quick.Input.NewProduct.vx]", (LPARAM)&arg); | 
 |  |  |  | 
 |  |  |       if (arg.GetArgString(L"data.modify") == L"1")RetrieveData(); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |    int OnAddFolder() | 
 |  |  |    { | 
 |  |  |       int hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       int hTopItem = LookupTopFolder(hItem); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |       xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |       xstring selectname = tv_folder.GetItemLabel(hItem); | 
 |  |  |  | 
 |  |  |       xaserverarg arg = ViewObject::MakeArg(); | 
 |  |  |       xaserverarg arg; | 
 |  |  |       if (hItem != hTopItem) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = tv_folder.GetItemData(hItem); | 
 |  |  | 
 |  |  |          if (folder != L"") | 
 |  |  |          { | 
 |  |  |             arg.AddArg(L"parentCategoryID", folder); | 
 |  |  |             OpenWindow(L"dev:xpage[UserFolderMaint.vx]", cast(arg as int)); | 
 |  |  |             OpenWindow(L"dev:xpage[UserFolderMaint.vx]",(LPARAM)&arg); | 
 |  |  |             /*if(arg.GetArgString(L"FolderID")!=L"") | 
 |  |  |             { | 
 |  |  |                int child = tv_folder.GetChildItem(hItem); | 
 |  |  | 
 |  |  |  | 
 |  |  |    int OnMaintFolder() | 
 |  |  |    { | 
 |  |  |       int hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       int hTopItem = LookupTopFolder(hItem); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |       xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |       xstring selectname = tv_folder.GetItemLabel(hItem); | 
 |  |  |  | 
 |  |  |       xaserverarg arg = ViewObject::MakeArg(); | 
 |  |  |       xaserverarg arg; | 
 |  |  |       if (name == L"个人库" && selectname == L"新产品" && tv_folder.GetParentItem(hItem) == hTopItem) return 1; | 
 |  |  |       if (hItem != hTopItem) | 
 |  |  |       { | 
 |  |  | 
 |  |  |          if (folder != L"") | 
 |  |  |          { | 
 |  |  |             arg.AddArg(L"CategoryID", folder); | 
 |  |  |             OpenWindow(L"dev:xpage[UserFolderMaint.vx]", cast(arg as int)); | 
 |  |  |             OpenWindow(L"dev:xpage[UserFolderMaint.vx]", (LPARAM)&arg); | 
 |  |  |             if (arg.GetArgString(L"label") != L"") | 
 |  |  |             { | 
 |  |  |                tv_folder.SetItemLabel(hItem, arg.GetArgString(L"label")); | 
 |  |  |             } | 
 |  |  |          } | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmCarGoodsMaint") | 
 |  |  |       { | 
 |  |  | #ifdef shouldfinish | 
 |  |  |          OpenWindow(L"dev:xpage[ShoppingCartProductMaint.vx]", trust(g_xdoc_shoppingcart as int)); | 
 |  |  | #endif | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmCarMaint") | 
 |  |  | 
 |  |  |          while (rw > 0) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement xe = OnGetCarListRowElement(rw); | 
 |  |  |             content += xe.xml; | 
 |  |  |             content += xe.xml(); | 
 |  |  |             rw = dwc_list.GetNextSelectRow(rw + 1); | 
 |  |  |  | 
 |  |  |          } | 
 |  |  |          content += L"</data>"; | 
 |  |  |          xaserverarg carg = new xaserverarg; | 
 |  |  |          carg.setNativePointer(carg.CreateInstance()); | 
 |  |  |          xaserverarg carg; | 
 |  |  | 			 | 
 |  |  |          carg.AddArg(L"content", content); | 
 |  |  |          int newArg2 = carg.ptr_native_; | 
 |  |  |          OpenWindow(L"dev:xpage[SO.Simulation.Import.vx]", newArg2); | 
 |  |  |          OpenWindow(L"dev:xpage[SO.Simulation.Import.vx]",  carg); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmEnquiry") | 
 |  |  |       { | 
 |  |  |          rw = dwc_list.GetNextSelectRow(1); | 
 |  |  |          content = L"<data>"; | 
 |  |  |          int rw = dwc_list.GetNextSelectRow(1); | 
 |  |  |          xstring content = L"<data>"; | 
 |  |  |          while (rw > 0) | 
 |  |  |          { | 
 |  |  |             xe = OnGetCarListRowElement(rw); | 
 |  |  |             content += xe.xml; | 
 |  |  |             KXMLDOMElement xe = OnGetCarListRowElement(rw); | 
 |  |  |             content += xe.xml(); | 
 |  |  |             rw = dwc_list.GetNextSelectRow(rw + 1); | 
 |  |  |          } | 
 |  |  |          content += L"</data>"; | 
 |  |  |          carg = new xaserverarg; | 
 |  |  |          carg.setNativePointer(carg.CreateInstance()); | 
 |  |  |          xaserverarg carg; | 
 |  |  | 			 | 
 |  |  |          carg.AddArg(L"content", content); | 
 |  |  |          newArg2 = carg.ptr_native_; | 
 |  |  |          OpenWindow(L"dev:xpage[Enquiry.Import.vx]", newArg2); | 
 |  |  |          OpenWindow(L"dev:xpage[Enquiry.Import.vx]", carg); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmPurchar") | 
 |  |  |       { | 
 |  |  |          rw = dwc_list.GetNextSelectRow(1); | 
 |  |  |          content = L"<data>"; | 
 |  |  |          int rw = dwc_list.GetNextSelectRow(1); | 
 |  |  |          xstring content = L"<data>"; | 
 |  |  |          while (rw > 0) | 
 |  |  |          { | 
 |  |  |             xe = OnGetCarListRowElement(rw); | 
 |  |  |             content += xe.xml; | 
 |  |  |             KXMLDOMElement xe = OnGetCarListRowElement(rw); | 
 |  |  |             content += xe.xml(); | 
 |  |  |             rw = dwc_list.GetNextSelectRow(rw + 1); | 
 |  |  |          } | 
 |  |  |          content += L"</data>"; | 
 |  |  |          carg = new xaserverarg; | 
 |  |  |          carg.setNativePointer(carg.CreateInstance()); | 
 |  |  |          xaserverarg carg ; | 
 |  |  |          carg.AddArg(L"content", content); | 
 |  |  |          newArg2 = carg.ptr_native_; | 
 |  |  |          OpenWindow(L"dev:xpage[PO.Import.vx]", newArg2); | 
 |  |  |          OpenWindow(L"dev:xpage[PO.Import.vx]", (LPARAM)&carg); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmSearch") | 
 |  |  | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmQuote") | 
 |  |  |       { | 
 |  |  |          rw = dwc_list.GetNextSelectRow(1); | 
 |  |  |          content = L"<data>"; | 
 |  |  |          int rw = dwc_list.GetNextSelectRow(1); | 
 |  |  |          xstring content = L"<data>"; | 
 |  |  |          while (rw > 0) | 
 |  |  |          { | 
 |  |  |             xe = OnGetCarListRowElement(rw); | 
 |  |  |             content += xe.xml; | 
 |  |  |             KXMLDOMElement xe = OnGetCarListRowElement(rw); | 
 |  |  |             content += xe.xml(); | 
 |  |  |             rw = dwc_list.GetNextSelectRow(rw + 1); | 
 |  |  |          } | 
 |  |  |          content += L"</data>"; | 
 |  |  |          carg = new xaserverarg; | 
 |  |  |          carg.setNativePointer(carg.CreateInstance()); | 
 |  |  |          xaserverarg carg; | 
 |  |  |          carg.AddArg(L"content", content); | 
 |  |  |          newArg2 = carg.ptr_native_; | 
 |  |  |          OpenWindow(L"dev:xpage[Quote.Import.vx]", newArg2); | 
 |  |  |          OpenWindow(L"dev:xpage[Quote.Import.vx]",  (LPARAM) & carg); | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmAdd") | 
 |  |  | 
 |  |  |       { | 
 |  |  |          int row = dw_list.GetRow(); | 
 |  |  |          if (row < 1) return 1; | 
 |  |  |          xstring skuid = g_xdoc_product.getData(0, L"data/Item", row, L"@guid"); | 
 |  |  |          xstring skuid = dw_list.GetItemString( row, L"@guid"); | 
 |  |  |          xml skuid_x = ViewObject::RetrieveData(L"/sale/data/ProductLibrary3/ProductNumberone", L"SKUID", skuid); | 
 |  |  |          xstring  skuidEx = skuid_x.text; | 
 |  |  |          xstring  skuidEx = skuid_x.text(); | 
 |  |  |          int  skuid1 = skuidEx.toInt(); | 
 |  |  |          if (skuid1) | 
 |  |  |          { | 
 |  |  | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmCarAdd") | 
 |  |  |       { | 
 |  |  |          hCursor = xutil::SetCursorWait(); | 
 |  |  |  | 
 |  |  |          name = GetControl(L"frame:ed_goodscar").GetText(); | 
 |  |  |          HCURSOR hCursor = xutil::SetCursorWait(); | 
 |  |  |          name = xcontrol(GetControl(L"frame:ed_goodscar")).GetText(); | 
 |  |  |          if (name != L"") | 
 |  |  |          { | 
 |  |  |             if (ShoppingCartView::AddCar(name) == 1) | 
 |  |  | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmPropConfigure") | 
 |  |  |       { | 
 |  |  | #ifdef shouldfinish | 
 |  |  |          int r = cast(g_xdoc_product.getData(L"data/Item", L"@guid") as int); | 
 |  |  |          OpenWindow(L"dev:xpage[Product.ItemProp.Maint.vx]", r); | 
 |  |  | #endif | 
 |  |  |          return 1; | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmRertieve") | 
 |  |  | 
 |  |  |       } | 
 |  |  |       else if (comdid == L"xmToCar") | 
 |  |  |       { | 
 |  |  |          name = GetControl(L"frame:cbx_goodscar").GetText(); | 
 |  |  |          name = xcontrol(GetControl(L"frame:cbx_goodscar")).GetText(); | 
 |  |  |          if (name == L"==选择购物车==L") | 
 |  |  |          { | 
 |  |  |             alert(L"请选择购物车"); | 
 |  |  | 
 |  |  |          xstring html = L"<data>"; | 
 |  |  |          while (xrow > 0) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement e = g_xdoc_product.getRowElement(L"data/Item", xrow); | 
 |  |  |             KXMLDOMElement e =dw_list.GetRowElement(xrow); | 
 |  |  |             goodsid = ProductLibraryView::GetElementString(e, L"@guid"); | 
 |  |  |             html += L"<item goodid='" + goodsid + L"' id ='" + ProductLibraryView::GetGuid() + L"'/>"; | 
 |  |  |             xrow = dw_list.GetNextSelectRow(xrow + 1); | 
 |  |  | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    //命令处理事件 | 
 |  |  |    int OnXCommand(ref TXCommandEvent evt, int param) | 
 |  |  |    int OnXCommand(TEvent* evt, int param) | 
 |  |  |    { | 
 |  |  |       return OnCmdDispatch(evt.pStrID); | 
 |  |  |       return OnCmdDispatch(evt->xcommand.pStrID); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    //查找当前树项的顶级目录 | 
 |  |  |    int LookupTopFolder(int hItem) | 
 |  |  |    HTREEITEM LookupTopFolder(HTREEITEM hItem) | 
 |  |  |    { | 
 |  |  |       int hRoot = tv_folder.GetRootItem(); | 
 |  |  |       HTREEITEM hRoot = tv_folder.GetRootItem(); | 
 |  |  |       while (tv_folder.GetParentItem(hItem)) hItem = tv_folder.GetParentItem(hItem); | 
 |  |  |       return hItem; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    //插入产品类项的子项 | 
 |  |  |    int MakeGoodsFolderItem(int hItem, xstring sno) | 
 |  |  |    int MakeGoodsFolderItem(HTREEITEM hItem, xstring sno) | 
 |  |  |    { | 
 |  |  |       xml x = ProductLibraryView::GetTreeChildItems3(sno); | 
 |  |  |       if (!x) return 0; | 
 |  |  |  | 
 |  |  |       KXMLDOMNodeList nlist = x.SelectNodes(L"//Item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = x.selectNodes(L"//Item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  | 
 |  |  |          xstring no = e.getAttribute(L"CategoryNo"); | 
 |  |  |          xstring label = no.trim() + L" " + name; | 
 |  |  |  | 
 |  |  |          int h = tv_folder.InsertChildItem(hItem, label, trust(e as int), 15); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, label, e, 15); | 
 |  |  |          xstring child = e.getAttribute(L"Childs"); | 
 |  |  |          if (child == L"") | 
 |  |  |             tv_folder.SetItemChild(h, 1); | 
 |  |  | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    //插入新产品目录子项 | 
 |  |  |    int MakeUserGoodsFolderItem(int hItem, xstring sno) | 
 |  |  |    int MakeUserGoodsFolderItem(HTREEITEM hItem, xstring sno) | 
 |  |  |    { | 
 |  |  |       xml x = ProductLibraryView::GetTreeUserChildItems3(sno); | 
 |  |  |       if (!x) return 0; | 
 |  |  |  | 
 |  |  |       KXMLDOMNodeList nlist = x.SelectNodes(L"//Item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = x.selectNodes(L"//Item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  | 
 |  |  |          xstring no = e.getAttribute(L"CategoryNo"); | 
 |  |  |          xstring label = no.trim() + L" " + name; | 
 |  |  |  | 
 |  |  |          int h = tv_folder.InsertChildItem(hItem, label, trust(e as int), 15); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, label, e, 15); | 
 |  |  |          xstring child = e.getAttribute(L"Childs"); | 
 |  |  |          if (child == L"") | 
 |  |  |             tv_folder.SetItemChild(h, 1); | 
 |  |  | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    //插入购物车项 | 
 |  |  |    int ExpandCatChildFolder(int hItem, KXMLDOMElement ele, int image) | 
 |  |  |    int ExpandCatChildFolder(HTREEITEM hItem, KXMLDOMElement ele, int image) | 
 |  |  |    { | 
 |  |  |       KXMLDOMNodeList nlist = ele.SelectNodes(L"item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = ele.selectNodes(L"item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       if (len > 0) tv_folder.SetItemChild(hItem, 1); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  |          xstring name = e.getAttribute(L"name"); | 
 |  |  |          int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), image); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); | 
 |  |  |          ExpandCatChildFolder(h, e, 35); | 
 |  |  |       } | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |    int MakeGoodCarFolderItem(int hItem) | 
 |  |  |    int MakeGoodCarFolderItem(HTREEITEM hItem) | 
 |  |  |    { | 
 |  |  |       xml x = ShoppingCartView::GetRoleList(); | 
 |  |  |       if (!x) return 0; | 
 |  |  |       KXMLDOMNodeList nlist = x.SelectNodes(L"/data/item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = x.selectNodes(L"/data/item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  |          xstring name = e.getAttribute(L"name"); | 
 |  |  |          int h = tv_folder.InsertChildItem(hItem, name, trust(e as int), 35); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, 35); | 
 |  |  |          ExpandCatChildFolder(h, e, 35); | 
 |  |  |       } | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int ExpandItem(int hItem) | 
 |  |  |    int ExpandItem(HTREEITEM hItem) | 
 |  |  |    { | 
 |  |  |       int hTopItem = LookupTopFolder(hItem); | 
 |  |  |       HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |       xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |       int child = tv_folder.GetChildItem(hItem); | 
 |  |  |       HTREEITEM child = tv_folder.GetChildItem(hItem); | 
 |  |  |       xstring no = L""; | 
 |  |  |       KXMLDOMElement e; | 
 |  |  |       if (name == L"公司库" && !child) | 
 |  |  | 
 |  |  |    //树展开 | 
 |  |  |    int OnTreeExpanding(TEvent * evt, int p) | 
 |  |  |    { | 
 |  |  |       ref NMTREEVIEW nmtv = evt.pnmh; | 
 |  |  |       int hItem = nmtv.itemNew.hItem; | 
 |  |  |       NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; | 
 |  |  |       HTREEITEM hItem = nmtv.itemNew.hItem; | 
 |  |  |       return ExpandItem(hItem); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int LookupCustomerFolder(int hItem) | 
 |  |  |    HTREEITEM LookupCustomerFolder(HTREEITEM hItem) | 
 |  |  |    { | 
 |  |  |       while (true) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); | 
 |  |  |          KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |          xstring str = e1.getAttribute(L"no"); | 
 |  |  |          if (str.find(L"Customer:") >= 0) return hItem; | 
 |  |  |          hItem = tv_folder.GetParentItem(hItem); | 
 |  |  | 
 |  |  |       return 0; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    xstring LookupCustomer(int hItem) | 
 |  |  |    xstring LookupCustomer(HTREEITEM hItem) | 
 |  |  |    { | 
 |  |  |       hItem = LookupCustomerFolder(hItem); | 
 |  |  |       if (hItem == 0) return ""; | 
 |  |  |       KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); | 
 |  |  |       if (hItem == 0) return L""; | 
 |  |  |       KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |       xstring str = e1.getAttribute(L"no"); | 
 |  |  |       return str.mid(L"Customer:".length(), 9999); | 
 |  |  |       return str.mid(xstring(L"Customer:").length(), 9999); | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int RetrieveData() | 
 |  |  |    { | 
 |  |  |       ximageview im = GetControl(L"im1"); | 
 |  |  |       int hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       int hTopItem = LookupTopFolder(hItem); | 
 |  |  |       HTREEITEM hItem = tv_folder.GetSelectedItem(); | 
 |  |  |       HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |       xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |       xstring selectname = tv_folder.GetItemLabel(hItem); | 
 |  |  |  | 
 |  |  | 
 |  |  |          dwc_list.SetReadOnly(true); | 
 |  |  |          dwc_list.Redraw(); | 
 |  |  |  | 
 |  |  |          im.ResetEx(); | 
 |  |  |          im.Reset(); | 
 |  |  |          im.Redraw(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |          htmlctrl xs1 = GetControl(L"html_detail"); | 
 |  |  |          xshtml xs1 = GetControl(L"html_detail"); | 
 |  |  |          xs1.SetContent(L"<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>"); | 
 |  |  |  | 
 |  |  |          if (name != L"公司库") return 1; | 
 |  |  |       } | 
 |  |  |       //return 1; | 
 |  |  |  | 
 |  |  |       int hCursor = xutil::SetCursorWait(); | 
 |  |  |       HCURSOR hCursor = xutil::SetCursorWait(); | 
 |  |  |  | 
 |  |  |       if (name == L"购物车") | 
 |  |  |       { | 
 |  |  |          if (selectname != name) | 
 |  |  |          { | 
 |  |  |             KXMLDOMElement e1 = cast(tv_folder.GetItemData(hItem) as KXMLDOMElement); | 
 |  |  |             KXMLDOMElement e1 = tv_folder.GetItemData(hItem); | 
 |  |  |             xstring str = e1.getAttribute(L"no"); | 
 |  |  |             alert(str); | 
 |  |  |             if (str.find(L"Customer:") == 0 || str.find(L"SO:") == 0) | 
 |  |  | 
 |  |  |                   dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodssolist"); | 
 |  |  |                dwc_list.Reset(); | 
 |  |  |                dwc_list.SetReadOnly(true); | 
 |  |  |                g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); | 
 |  |  |                dw_list.Retrieve(ShoppingCartView::GetGoodsList(str, queryString)); | 
 |  |  |             } | 
 |  |  |             else if (e1.getAttribute(L"categoryid") != L"") | 
 |  |  |             { | 
 |  |  |                xstring categoryid = e1.getAttribute(L"categoryid"); | 
 |  |  |                dwc_list.SetDataObject(ProductLibraryView::GetMaintListForm3(categoryid).GetXmlDoc()); | 
 |  |  |                dwc_list.SetDataObject(ProductLibraryView::GetMaintListForm3(categoryid)); | 
 |  |  |                dwc_list.SetReadOnly(true); | 
 |  |  |                dwc_list.Reset(); | 
 |  |  |                g_xdoc_shoppingcart.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString, L"")); | 
 |  |  |                dw_list.Retrieve(ProductLibraryView::GetMaintList3(categoryid, queryString, L"")); | 
 |  |  |                dwc_list.Redraw(); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  | 
 |  |  |                dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodslist"); | 
 |  |  |                dwc_list.SetReadOnly(true); | 
 |  |  |                dwc_list.Reset(); | 
 |  |  |                g_xdoc_shoppingcart.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); | 
 |  |  |                dw_list.Retrieve(ShoppingCartView::GetGoodsList(selectname, queryString)); | 
 |  |  |             } | 
 |  |  |             dwc_list.PostRetrieve(); | 
 |  |  |             //dwc_list.PostRetrieve(); | 
 |  |  |             dwc_list.Redraw(); | 
 |  |  |  | 
 |  |  |             xshtml xs = GetControl(L"html_detail"); | 
 |  |  |             if (dwc_list.GetRowCount() >= 1) | 
 |  |  |             { | 
 |  |  |                htmlctrl xs = GetControl(L"html_detail"); | 
 |  |  |                xs.SetContent(makeGoodscarHtml(1)); | 
 |  |  |  | 
 |  |  |                if (m_customer != L"") | 
 |  |  |                { | 
 |  |  |                   xstring skuid = g_xdoc_shoppingcart.getData(0, L"data/Item", 1, L"SKUID"); | 
 |  |  |                   xstring customerItemNo = g_xdoc_shoppingcart.getData(0, L"data/Item", 1, L"CustomerItemNo"); | 
 |  |  |                   xstring skuid =dw_list.GetItemString( 1, L"SKUID"); | 
 |  |  |                   xstring customerItemNo =dw_list.GetItemString( 1, L"CustomerItemNo"); | 
 |  |  |                   OnShowImage(skuid, customerItemNo); | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |  | 
 |  |  |                im.ResetEx(); | 
 |  |  |                im.Reset(); | 
 |  |  |                im.Redraw(); | 
 |  |  |  | 
 |  |  |                xs = GetControl(L"html_detail"); | 
 |  |  | 
 |  |  |                KXMLDOMElement e = tv_folder.GetItemData(hItem); | 
 |  |  |                no = e.getAttribute(L"guid"); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |                return 1; | 
 |  |  |  | 
 |  |  |             /*   dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(no).GetXmlDoc()); | 
 |  |  |             /*   dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(no)); | 
 |  |  |                dw_list = GetControl(L"dw_list"); | 
 |  |  |                dw_list.Reset(); | 
 |  |  |                dw_list.SetReadOnly(true); | 
 |  |  |             */ | 
 |  |  |  | 
 |  |  |             if (name == L"个人库") | 
 |  |  |                g_xdoc_product.Retrieve(ProductLibraryView::GetMaintRoleList3(no)); | 
 |  |  |                dw_list.Retrieve(ProductLibraryView::GetMaintRoleList3(no)); | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                if (queryString != L"") | 
 |  |  |                { | 
 |  |  |  | 
 |  |  |                   if (no == L"N000005") | 
 |  |  |                      g_xdoc_product.Retrieve(ProductLibraryView::GetMaintList3(L"", queryString, L"")); | 
 |  |  |                      dw_list.Retrieve(ProductLibraryView::GetMaintList3(L"", queryString, L"")); | 
 |  |  |                   else | 
 |  |  |                      g_xdoc_product.Retrieve(ProductLibraryView::GetMaintList3(no, queryString, L"")); | 
 |  |  |                      dw_list.Retrieve(ProductLibraryView::GetMaintList3(no, queryString, L"")); | 
 |  |  |                } | 
 |  |  |                else | 
 |  |  |                   g_xdoc_product.Retrieve(ProductLibraryView::GetMaintList3(no)); | 
 |  |  |                { | 
 |  |  |                   if (no == L"N000005") return 1; | 
 |  |  |                   dw_list.Retrieve(ProductLibraryView::GetMaintList3(no)); | 
 |  |  |                } | 
 |  |  |             } | 
 |  |  |             dw_list.PostRetrieve(); | 
 |  |  |             //dw_list.PostRetrieve(); | 
 |  |  |             dw_list.Redraw(); | 
 |  |  |  | 
 |  |  |             xshtml xs = GetControl(L"html_detail"); | 
 |  |  |             if (dw_list.GetRowCount() > 0) | 
 |  |  |             { | 
 |  |  |                xs = GetControl(L"html_detail"); | 
 |  |  |                xs.SetContent(makeHtml(1)); | 
 |  |  |                xstring id = g_xdoc_product.getData(0, L"data/Item", 1, L"@guid"); | 
 |  |  |                xstring id = dw_list.GetItemString( 1, L"@guid"); | 
 |  |  |                OnShowImage(id); | 
 |  |  |             } | 
 |  |  |             else | 
 |  |  |             { | 
 |  |  |                im.ResetEx(); | 
 |  |  |                im.Reset(); | 
 |  |  |                im.Redraw(); | 
 |  |  |  | 
 |  |  |                xs = GetControl(L"html_detail"); | 
 |  |  |                xs.SetContent(L"<html><body style='margin:2;background-color:#ccdccc none #f0f0f0 none'/></html>"); | 
 |  |  |             } | 
 |  |  |             xs.Redraw(); | 
 |  |  | 
 |  |  |  | 
 |  |  |    int OnTreeSelChanged(TEvent * evt, int p) | 
 |  |  |    { | 
 |  |  |       ref NMTREEVIEW nmtv = cast(evt.pnmh as NMTREEVIEW); | 
 |  |  |       int hItem = nmtv.itemNew.hItem; | 
 |  |  |       int hTopItem = LookupTopFolder(hItem); | 
 |  |  |       NMTREEVIEW& nmtv = *(NMTREEVIEW*)evt->notify.pnmh; | 
 |  |  |       HTREEITEM hItem = nmtv.itemNew.hItem; | 
 |  |  |       HTREEITEM hTopItem = LookupTopFolder(hItem); | 
 |  |  |       xstring name = tv_folder.GetItemLabel(hTopItem); | 
 |  |  |       xstring selectname = tv_folder.GetItemLabel(hItem); | 
 |  |  |       ximageview im = GetControl(L"im1"); | 
 |  |  | 
 |  |  |             ResetAgent(L"goodslib"); | 
 |  |  |       } | 
 |  |  |       //RetrieveData(); | 
 |  |  |       win32::PostMessage(GetHWND(), 0x401, L"xmRefresh", 0); | 
 |  |  |       PostMessage(GetHWND(), 0x401, (WPARAM)L"xmRefresh", 0); | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int  ExpandChildFolder(int hItem, KXMLDOMElement pElement) | 
 |  |  |    int  ExpandChildFolder(HTREEITEM hItem, KXMLDOMElement pElement) | 
 |  |  |    { | 
 |  |  |       KXMLDOMNodeList nlist = pElement.SelectNodes(L"Item"); | 
 |  |  |       int len = nlist.length; | 
 |  |  |       KXMLDOMNodeList nlist = pElement.selectNodes(L"Item"); | 
 |  |  |       int len = nlist.length(); | 
 |  |  |       for (int i = 0; i < len; i++) | 
 |  |  |       { | 
 |  |  |          KXMLDOMElement e = nlist.item(i); | 
 |  |  | 
 |  |  |          xstring sImage = e.getAttribute(L"image"); | 
 |  |  |          int image = 15; | 
 |  |  |          //if(sImage) image = sImage.toInt(); | 
 |  |  |          int h = tv_folder.InsertChildItem(tv_folder.GetId(), hItem, name, trust(e as int), image); | 
 |  |  |          HTREEITEM h = tv_folder.InsertChildItem(hItem, name, e, image); | 
 |  |  |          tv_folder.SetItemChild(h, 1); | 
 |  |  |          ExpandChildFolder(h, e); | 
 |  |  |       } | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnViewZoomChange(ref TCommandEvent evt, int lParam) | 
 |  |  |    int OnViewZoomChange(TEvent* evt, int lParam) | 
 |  |  |    { | 
 |  |  |       ximageview im = GetControl(L"im1"); | 
 |  |  |       xcombobox xc = GetControl(L"precent"); | 
 |  |  |       xstring text = xcombobox::GetLBText(xc.GetId()); | 
 |  |  |       xstring text = xc.GetLBText(); | 
 |  |  |       int p = text.toInt(); | 
 |  |  |       if (p == 0) p = 100; | 
 |  |  |       im.Preview(p); | 
 |  |  | 
 |  |  |    int OnAttachEvent() | 
 |  |  |    { | 
 |  |  |       //绑定工具条点击事件 | 
 |  |  |       AttachEvent(L"WM_XCOMMAND", OnXCommand); | 
 |  |  |       AttachEvent(L"WM_XCOMMAND", (FEvent)&ProductLibrary4Win::OnXCommand); | 
 |  |  |       //获取焦点事件,用于重置工具条 | 
 |  |  |       AttachEvent(L"WM_SETFOCUS", OnSetFocus); | 
 |  |  |       AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", OnRowChanged); | 
 |  |  |       AttachEvent(L"dwc_list", L"DWV_ROWFOCUSCHANGED", OnGoodsCarRowChanged); | 
 |  |  |       AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING", OnTreeExpanding); | 
 |  |  |       AttachEvent(L"tv_folder", L"TVN_SELCHANGED", OnTreeSelChanged); | 
 |  |  |       AttachEvent(L"WM_COMMAND", OnCkbCLick);   //checkbox打钩事件 | 
 |  |  |       AttachEvent(L"WM_COMMAND", OnCkbCLick2);   //checkbox打钩事件	 | 
 |  |  |       AttachEvent(L"WM_SETFOCUS", (FEvent)&ProductLibrary4Win::OnSetFocus); | 
 |  |  |       AttachEvent(L"dw_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductLibrary4Win::OnRowChanged); | 
 |  |  |       AttachEvent(L"dwc_list", L"DWV_ROWFOCUSCHANGED", (FEvent)&ProductLibrary4Win::OnGoodsCarRowChanged); | 
 |  |  |       AttachEvent(L"tv_folder", L"TVN_ITEMEXPANDING", (FEvent)&ProductLibrary4Win::OnTreeExpanding); | 
 |  |  |       AttachEvent(L"tv_folder", L"TVN_SELCHANGED", (FEvent)&ProductLibrary4Win::OnTreeSelChanged); | 
 |  |  |       AttachEvent(L"WM_COMMAND", (FEvent)&ProductLibrary4Win::OnCkbCLick);   //checkbox打钩事件 | 
 |  |  |       AttachEvent(L"WM_COMMAND", (FEvent)&ProductLibrary4Win::OnCkbCLick2);   //checkbox打钩事件	 | 
 |  |  |  | 
 |  |  |       AttachEvent(L"im1", L"IMG_LDBCLICK", OnImgDBClicked); | 
 |  |  |       AttachEvent(L"precent", L"CBN_SELCHANGE", OnViewZoomChange); | 
 |  |  |       AttachEvent(L"im1", L"IMG_LDBCLICK", (FEvent)&ProductLibrary4Win::OnImgDBClicked); | 
 |  |  |       AttachEvent(L"precent", L"CBN_SELCHANGE", (FEvent)&ProductLibrary4Win::OnViewZoomChange); | 
 |  |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int onload() | 
 |  |  |    { | 
 |  |  |       agentFor = L"goodslib"; | 
 |  |  |       m_customer = 0; | 
 |  |  |       imageElement = 0; | 
 |  |  |  | 
 |  |  |       OnAttachEvent(); | 
 |  |  |  | 
 |  |  | 
 |  |  |  | 
 |  |  |       InitialFolder(); | 
 |  |  |  | 
 |  |  |       g_xdoc_product = new xdataset; | 
 |  |  |       g_xdoc_product.Init(); | 
 |  |  |       xbind bindproduct = new xbind; | 
 |  |  |       bindproduct.bindEx(dw_list, g_xdoc_product, L""); | 
 |  |  |  | 
 |  |  |       g_xdoc_shoppingcart = new xdataset; | 
 |  |  |       g_xdoc_shoppingcart.Init(); | 
 |  |  |  | 
 |  |  |       xbind bindcart = new xbind; | 
 |  |  |       bindcart.bindEx(dwc_list, g_xdoc_shoppingcart, L""); | 
 |  |  |  | 
 |  |  |       dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"").GetXmlDoc()); | 
 |  |  |       dw_list.SetDataObject(ProductLibraryView::GetMaintListForm3(L"")); | 
 |  |  |       dw_list = GetControl(L"dw_list"); | 
 |  |  |       dw_list.SetReadOnly(true); | 
 |  |  |  | 
 |  |  |       dwc_list.openUrl(L"/sale/view/ProductLibrary/template/cart/goodslist"); | 
 |  |  |       dwc_list.SetReadOnly(true); | 
 |  |  |  | 
 |  |  |       tv_folder.ExpandItem(tv_folder.GetRootItem()); | 
 |  |  |       tv_folder.ItemFocus(tv_folder.GetRootItem()); | 
 |  |  |  | 
 |  |  |       if (dw_list.GetRowCount()) | 
 |  |  |       { | 
 |  |  |          htmlctrl xs = GetControl(L"html_detail"); | 
 |  |  |          xshtml xs = GetControl(L"html_detail"); | 
 |  |  |          xs.SetContent(makeHtml(1)); | 
 |  |  |       } | 
 |  |  |  | 
 |  |  |       tv_folder.ExpandItem(tv_folder.GetRootItem()); | 
 |  |  |       tv_folder.ItemFocus(tv_folder.GetRootItem()); | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  | 
 |  |  |       return 1; | 
 |  |  |    } | 
 |  |  |  | 
 |  |  |    int OnImgDBClicked(TEvent * evt, int pr) | 
 |  |  |    int OnImgDBClicked(TEvent * evt, LPARAM  pr) | 
 |  |  |    { | 
 |  |  |       ref IMGNNMHDR nmtv = evt.pnmh; | 
 |  |  |       IMGNNMHDR& nmtv = *(IMGNNMHDR*)evt->notify.pnmh; | 
 |  |  |       xstring src = nmtv.path; | 
 |  |  |       /*if(src.length() > 60) | 
 |  |  |          src = src.right(44); | 
 |  |  |       else | 
 |  |  |          src=src.mid(src.find(L"Thumbs", 0)+6, 50); | 
 |  |  |       */ | 
 |  |  |       xaserverarg arg = new xaserverarg; | 
 |  |  |       arg.setNativePointer(arg.CreateInstance()); | 
 |  |  |       xaserverarg& arg = *new xaserverarg; | 
 |  |  |       //arg.AddArg(L"src",L"/business/products/chanpin"+src);    | 
 |  |  |       arg.AddArg(L"src", src); | 
 |  |  |  | 
 |  |  |       //win::OpenWindow(L"dev:xpage[BigPicture.vx]",arg);    | 
 |  |  |  | 
 |  |  |       int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", arg); | 
 |  |  |       int h = openUrl(L"/sale/view/ProductLibrary/xpage/bigpictureview", &arg); | 
 |  |  |       return 1; | 
 |  |  |       /* | 
 |  |  |       xwin x = new xwin; |