LiFan
2025-04-29 6c8c9ddaeb2bc6245a374c9354296bcfc2d96c06
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
ÿþ#include <wobject/xstring.hpp>
#include <xcontrol/xtreeview.hpp>
#include <xcontrol/xdwgrid.hpp>
#include <wobject/xdouble.hpp>
#include <xcontrol/xlayersheet.hpp>
#include <xcontrol/xdatetimepick.hpp>
#include <xcontrol/ximageview.hpp>
 
#include "vbusiness/vframe/listwin.vframe.vbusiness.hpp"
#include "viewobject/view.base.hpp"
 
 
 
using xml = KXMLDOMDocument;
class __declspec(dllexport) ViewPicturesEx : public xframe
{
public:
    ViewPicturesEx(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {}
public:
    static ViewPicturesEx* CreateInstance(void* implPtr, void* hWnd)
    {
        return  new ViewPicturesEx(implPtr, (HWND)hWnd);
    }
public:
    KXMLDOMElement imageElement;
    xstring m_customer;
 
    int OnCmdDispatch(xstring comdid)
    {
        if(comdid==L"xmClose")
        {
            CloseWindow();
            return 1;
        }
        return 0;
    }
 
    int OnXCommand(TEvent* evt, LPARAM param)
    {
        return OnCmdDispatch(evt->xcommand.pStrID);
    }
 
    int OnAttachEvent()
    {
        AttachEvent(L"WM_XCOMMAND", (FEvent)&ViewPicturesEx::OnXCommand);
        return 1;
    }
        
        int OnShowImage(xstring skuid,xstring customerItemNo,xstring CustomerID)
        {
            ximageview im = GetControl(L"im1");
            im.Reset();
            
            xml xp;
            
            xaserverarg arg_pic;
                
            
            arg_pic.AddArg(L"SKUID",skuid);
            arg_pic.AddArg(L"CustomerID",CustomerID);
            arg_pic.AddArg(L"CustomerItemNo",customerItemNo);
            
            //alert(arg_pic.GetString());
            
            if(xurl::get(L"/sale/data/ProductLibrary3/pref/picture/customer/imagelistSKU",arg_pic.GetString(),xp)!=1)
            {
                trace(L"error:" + (xstring)xp.xml());
            }else
            {
                imageElement = xp.documentElement();
                KXMLDOMNodeList  nlistp=  xp.selectNodes(L"ImageList/image");
                int lenp = nlistp.length();
                if(lenp >0)
                {
                    for(int ip=0;ip<lenp;ip++)
                    {
                        KXMLDOMElement xitem = nlistp.item(ip);
                        xstring picname = xitem.selectSingleNode(L"PicPath").text(); 
                        xstring goodno = xitem.selectSingleNode(L"GoodsNo").text();     
        
                        if(picname == L"/business/products/Thumbs//")
                            picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
                        im.AddImages(picname, L"");
                    }
                }
                else
                {
                    OnShowImageEx(skuid);
                
                }
                im.Redraw();
                
            }
            return 1;
        }
    
        int OnShowImageEx(xstring skuid)
        {
            ximageview im = GetControl(L"im1");
            //im.RemoveImage();
            im.Reset();
            
            xml xp;
            
            xaserverarg arg_pic;
                
            arg_pic.AddArg(L"SKUID",skuid);
            if(xurl::get(L"/sale/data/ProductLibrary3/pref/picture/imagelistSKU",arg_pic.GetString(),xp)!=1)
            {
                trace(xstring(L"xxx",xp.xml()));
            }else
            {
                
                trace(skuid+L"===== L"+xp.xml());
                imageElement = xp.documentElement();
                KXMLDOMNodeList  nlistp=  xp.selectNodes(L"ImageList/image");
                int lenp = nlistp.length();
                for(int ip=0;ip<lenp;ip++)
                {
                    KXMLDOMElement xitem = nlistp.item(ip);
                    xstring picname = xitem.selectSingleNode(L"PicPath").text(); 
                    xstring goodno = xitem.selectSingleNode(L"GoodsNo").text();     
                    if(picname == L"/business/products/Thumbs//")
                        picname = L"/business/products/Thumbs/00/00000000-0000-0000-0000-000000000000.jpg";
                    im.AddImages(picname, L"");
                }
                im.Redraw();
                //SendMessage(im.GetId(),0x000f,0,1);
                //InvalidateRect(im.GetId(),cast(0 as ref xrect),true);
            }
            return 1;
        }
                    
    int onload()
    {  
        SetArg();
        OnAttachEvent();
        xaserverarg arg ;
            
        int p = GetArg();
        
        xstring skuid = arg.GetArgString(L"guid");
        xstring customerItemNo=arg.GetArgString(L"CustomerItemNo");
        xstring CustomerID=arg.GetArgString(L"CustomerID");
        OnShowImage(skuid,customerItemNo,CustomerID);
        return 1;
    }
};