xj qian
2024-07-18 3a3137b405af9728f9a7e4d7ee725498d0e8ecb7
jrj/project/business/BasicCode/QuickCode.cpp
@@ -3,12 +3,13 @@
#include <xcontrol/xdwgrid.hpp>
#include <wobject/xdouble.hpp>
#include <xcontrol/xlayersheet.hpp>
#include <wobject/xpage.hpp>
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
using xml = KXMLDOMDocument;
class __declspec(dllexport) QuickCode : public xwin
class __declspec(dllexport) QuickCode : public xframe
{
public:
   xdwgrid   dw_list;
@@ -22,19 +23,14 @@
   KXMLDOMDocument m_configDoc;
   xnode   m_agentNode;
public:
   QuickCode(void* implPtr, HWND hWnd) :xwin(implPtr, hWnd) {}
   QuickCode(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
   static QuickCode* CreateInstance(void* implPtr, void* hWnd)
   {
      QuickCode* pWin = new QuickCode(implPtr, (HWND)hWnd);
      return pWin;
   }
   int alert(xstring str)
   {
      //win::MessageBox(GetHWND(),str,L"提示:",0);
      TApp::alert(this, str);
      return 0;
   }
   int SetAgent()
   {
      xstring xfNodeAgentArea = L"agentarea";
@@ -183,8 +179,8 @@
         {
            xstring CategoryID = arg.GetArgString(L"CategoryID");
            xstring CName = arg.GetArgString(L"CName");
            dw_list.SetItemDisplayString(row, colname, CName);
            dw_list.SetItemString(row, colname, CategoryID);
            dw_list.SetItemDisplayString(row, colname.c_str(), CName);
            dw_list.SetItemString(row, colname.c_str(), CategoryID);
            dw_list.Redraw();
         }
      }
@@ -196,8 +192,8 @@
         {
            xstring OrgName = arg.GetArgString(L"OrgName");
            xstring OrgId = arg.GetArgString(L"OrgId");
            dw_list.SetItemDisplayString(row, colname, OrgName);
            dw_list.SetItemString(row, colname, OrgId);
            dw_list.SetItemDisplayString(row, colname.c_str(), OrgName);
            dw_list.SetItemString(row, colname.c_str(), OrgId);
            dw_list.Redraw();
         }
      }
@@ -210,8 +206,8 @@
            xstring sPersonID = arg.GetArgString(L"sPersonID");
            trace(sPersonID);
            xstring sPersonName = arg.GetArgString(L"sPersonName");
            dw_list.SetItemDisplayString(row, colname, sPersonName);
            dw_list.SetItemString(row, colname, sPersonID);
            dw_list.SetItemDisplayString(row, colname.c_str(), sPersonName);
            dw_list.SetItemString(row, colname.c_str(), sPersonID);
            dw_list.Redraw();
         }
      }
@@ -227,14 +223,14 @@
      //xstring str = hdr.data;
      xstring colname = hdr.colname;
      xstring str = dw_list.GetItemString(row, colname);
      xstring str = dw_list.GetItemString(row, colname.c_str());
      arg.AddArg(L"value", str);
      openUrl(L"/sale/view/view.dlg/xpage/memo/edit", arg);
      xstring comdid = arg.GetArgString(L"comdid");
      if (comdid == L"xmOK")
      {
         xstring value = arg.GetArgString(L"value");
         dw_list.SetItemString(row, colname, value);
         dw_list.SetItemString(row, colname.c_str(), value);
         dw_list.Redraw();
      }
@@ -242,7 +238,7 @@
   }
   int ItemOutput()
   {
      xstring d = xaserver::GetCurrentDate();
      xstring d = publiccode::GetCurrentDate();
      d = d.left(10) + L"";
      dw_list.SaveAs(d);
      return 1;
@@ -292,10 +288,10 @@
      while (row > 0)
      {
         xstring tmp;
         if (dw_list.GetItemDisplayString(row, col))
            tmp = dw_list.GetItemDisplayString(row, col);
         if (dw_list.GetItemDisplayString(row, col.c_str()))
            tmp = dw_list.GetItemDisplayString(row, col.c_str());
         else
            tmp = dw_list.GetItemString(row, col);
            tmp = dw_list.GetItemString(row, col.c_str());
         str += tmp + L"\r\n";
         row = dw_list.GetNextSelectRow(row + 1);
      }
@@ -308,25 +304,25 @@
      DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh;
      int row = hdr.row;
      int m = win::CreatePopupMenu();
      HMENU m = CreatePopupMenu();
      int MF_STRING = 0x00000000;
      int MF_DISABLED = 0x00000002;
      int TPM_RIGHTBUTTON = 0x0002;
      int TPM_RETURNCMD = 0x0100;
      int MF_CHECKED = 0x8;
      int MF_SEPARATOR = 0x0800;
      win::AppendMenu(m, MF_STRING, 1, L"复制行");
      win::AppendMenu(m, MF_STRING, 101, L"复制列");
      win::AppendMenu(m, MF_SEPARATOR, -1, L"");
      win::AppendMenu(m, MF_STRING, 2, L"ȫѡ");
      win::AppendMenu(m, MF_SEPARATOR, -1, L"");
      win::AppendMenu(m, MF_STRING, 4, L"导出到Excel");
      win::AppendMenu(m, MF_SEPARATOR, -1, L"");
      win::AppendMenu(m, MF_STRING, 6, L"显示列设置");
      xrect xr;
      AppendMenu(m, MF_STRING, 1, L"复制行");
      AppendMenu(m, MF_STRING, 101, L"复制列");
      AppendMenu(m, MF_SEPARATOR, -1, L"");
      AppendMenu(m, MF_STRING, 2, L"ȫѡ");
      AppendMenu(m, MF_SEPARATOR, -1, L"");
      AppendMenu(m, MF_STRING, 4, L"导出到Excel");
      AppendMenu(m, MF_SEPARATOR, -1, L"");
      AppendMenu(m, MF_STRING, 6, L"显示列设置");
      RECT xr;
      xpoint pt;
      win::GetCursorPos(pt);
      int ret = win::TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), xr);
      GetCursorPos(pt);
      int ret = TrackPopupMenu(m, TPM_RIGHTBUTTON | TPM_RETURNCMD, pt.x, pt.y, 0, GetHWND(), &xr);
      //trace(ret);
      HCURSOR hCursor = xutil::SetCursorWait();
@@ -414,26 +410,15 @@
            p = p.mid(p.find(L"&", 0) + 1, p.length());
         }
      }
      return "";
      return L"";
   }
   int getURLParam()
   {
      if (GetWinParam())
      {
         xpage xp = new xpage;
         xp.setNativePointer(GetXPage());
         xpage xp = GetXPage();
         xstring aurl = xp.GetWkUrl();
         xaserverarg arg;
         if (aurl && aurl.find(L"native=true", 0) > 0)
         {
            int p = GetParam();
            arg;
            arg.setNativePointer(p);
         }
         else
         {
            arg = GetParam();
         }
         xaserverarg arg = GetArg();
         xstring config = arg.GetArgString(L"config");
         xml x;
@@ -457,7 +442,7 @@
      getURLParam();
      KXMLDOMDocument    ee = m_configDoc;
      xstring id = m_id;
      var n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']");
      auto n = ee.selectSingleNode(L"//list/dwview[@type='dwgrid'][@id='" + id + L"']");
      xstring vface = m_configDoc.selectSingleNode(L"//vface[1]").text();
      xstring dwname = L"";//e.selectsingleNode(L"@name").text();
      xstring tpl = L"";//e.selectsingleNode(L"@url").text();
@@ -474,7 +459,7 @@
      }
      else
      {
         var m = ee.selectSingleNode(L"//list");
         auto m = ee.selectSingleNode(L"//list");
         KXMLDOMElement e1 = m;
         //trace(e.xml());
         if (e1.selectSingleNode(L"@name")) dwname = e1.selectSingleNode(L"@name").text();
@@ -487,7 +472,7 @@
      dw_list.setNativePointer(GetControl(dwname));
      dw_list.openUrl(vface + L"/" + tpl);
      //dw_list.SetSelectionMode(4);                     
      return 1;
   }
   int Onital()
   {
@@ -503,9 +488,9 @@
         return -1;
      }
      var list = x1.selectNodes(L"root/item");
      auto list = x1.selectNodes(L"root/item");
      int i;
      int s = list.length;
      int s = list.length();
      if (s > 0)
      {
         xstring str = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='&lt;data>";
@@ -538,9 +523,9 @@
         return -1;
      }
      var list1 = x2.selectNodes(L"root/item");
      auto list1 = x2.selectNodes(L"root/item");
      int j;
      int s1 = list1.length;
      int s1 = list1.length();
      if (s1 > 0)
      {
         xstring str1 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='&lt;data>";
@@ -573,9 +558,9 @@
         return -1;
      }
      var list2 = x3.selectNodes(L"root/item");
      auto list2 = x3.selectNodes(L"root/item");
      int k;
      int s2 = list2.length;
      int s2 = list2.length();
      if (s2 > 0)
      {
         xstring str2 = L"<cellprop celltype='' cellformatex='' cellformat='' cellprotectex='' cellprotect='保护' cellvisibleex='' cellvisible='' cellvalid='' cellinitial=''><edit edittype='ddlb' ddlbxml='&lt;data>";