| | |
| | | #include "wobject/xstring.hpp" |
| | | #include "wobject/xurl.hpp" |
| | | #include "xcontrol/xshtml.hpp" |
| | | #include "vbusiness/vframe/frame.vframe.vbusiness.hpp" |
| | | #include "viewobject/view.base.hpp" |
| | | #include "xcontrol/xshtml.hpp" |
| | | |
| | | class __declspec(dllexport) startvframevbusiness: public xwin |
| | | using xml = Hxsoft::XFrame::KXMLDOMDocument; |
| | | |
| | | class __declspec(dllexport) startvframevbusiness : public xframe |
| | | { |
| | | public: |
| | | xreport dw_list; |
| | | xreport dw_list; |
| | | public: |
| | | startvframevbusiness(void* implPtr,HWND hWnd):xwin(implPtr,hWnd){} |
| | | startvframevbusiness(void* implPtr, HWND hWnd) :xframe(implPtr, hWnd) {} |
| | | public: |
| | | static startvframevbusiness * CreateInstance(void* implPtr,void* hWnd) |
| | | static startvframevbusiness* CreateInstance(void* implPtr, void* hWnd) |
| | | { |
| | | startvframevbusiness* pWin = new startvframevbusiness(implPtr,(HWND)hWnd); |
| | | return pWin; |
| | | return new startvframevbusiness(implPtr, (HWND)hWnd); |
| | | } |
| | | public: |
| | | int OnCmdDispatch(const wchar_t* comd) |
| | | |
| | | int init() |
| | | { |
| | | //alert(comd); |
| | | return 0; |
| | | } |
| | | |
| | | int OnXCommand(TEvent* evt,int p) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | xaserverarg arg; |
| | | KXMLDOMDocument doc; |
| | | if (xurl::get(GetServerUrl(), L"/sale/data/vpage/vstart/list", arg.GetString(), doc) != 1) |
| | | { |
| | | alert(((xstring)L"error:" + doc.xml()).c_str()); |
| | | return 0; |
| | | } |
| | | if (!doc.xml()) return 0; |
| | | |
| | | int ShowDetail(int row) |
| | | { |
| | | if(row<0 || row>dw_list.GetRowCount()) return 1; |
| | | if(!dw_list.GetRowElement(row)) return 1; |
| | | |
| | | Hxsoft::XFrame::KXMLDOMElement ele = dw_list. GetRowElement(row); |
| | | //alert(ele.xml()); |
| | | dw_list.SetRow(row); |
| | | |
| | | string EntityID=ele.getAttribute(L"EntityID"); |
| | | |
| | | if(!EntityID || !EntityID[0]) return -1; |
| | | //SetAgent("letter",GetEntityID(1)); |
| | | |
| | | xaserverarg arg; |
| | | arg.AddArg(L"content",ele.xml()); |
| | | Hxsoft::XFrame::KXMLDOMDocument doc; |
| | | if(xurl::get(GetServerUrl(),L"/sale/data/vpage/vstart/task",arg.GetString(),doc)!=1) |
| | | { |
| | | alert(((xstring)L"error:"+doc.xml()).c_str()); |
| | | return 0; |
| | | } |
| | | //alert(doc.xml()); |
| | | xshtml ht(GetControl(L"taskinfo")); |
| | | ht.SetContent(doc.xml()); |
| | | ht.Redraw(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //#include <tchar.h> |
| | | int OnClicked(TEvent* evt,int p) |
| | | { |
| | | DWNMHDR* hdr = (DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr->row; |
| | | |
| | | if(row<1 || row>dw_list.GetRowCount()) return 1; |
| | | |
| | | ShowDetail(row); |
| | | //SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int init() |
| | | { |
| | | xaserverarg arg; |
| | | KXMLDOMDocument doc; |
| | | if(xurl::get(GetServerUrl(),L"/sale/data/vpage/vstart/list",arg.GetString(),doc)!=1) |
| | | { |
| | | alert(((xstring)L"error:"+doc.xml()).c_str()); |
| | | return 0; |
| | | } |
| | | if(!doc.xml()) return 0; |
| | | |
| | | dw_list.Retrieve(doc); |
| | | dw_list.CreateTree((LPCWSTR)L"node()", 1, 15, 16); |
| | | |
| | | /* |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | */ |
| | | return 1; |
| | | } |
| | | |
| | | int OnAttachListon() |
| | | { |
| | | AttachEvent(L"WM_XCOMMAND",(FEvent)&startvframevbusiness::OnXCommand,this); |
| | | AttachEvent(L"tasklist",L"DWV_CLICKED",(FEvent)&startvframevbusiness::OnClicked,this); |
| | | //AttachEvent("mdilayer", "LYSN_SELECTEDSHEET",OnSheetChanged); |
| | | ////AttachEvent("mdilayer", "LYSN_CLOSESHEET",OnCloseSheet); |
| | | dw_list.Retrieve(doc); |
| | | dw_list.CreateTree((LPCWSTR)L"node()", 1, 15, 16); |
| | | dw_list.Redraw(); |
| | | /* |
| | | dw_list.Redraw(); |
| | | dw_list.SetReadOnly(true); |
| | | */ |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | xstring GetEntityIDName(LPARAM pr) |
| | | { |
| | | return L"@EntityID"; |
| | | } |
| | | |
| | | xstring GetEntityName(LPARAM pr) |
| | | { |
| | | int nRow = dw_list.GetRow(); |
| | | if (nRow < 0) return L""; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(nRow); |
| | | if (!ele) return L""; |
| | | return ele.getAttribute(L"category"); |
| | | } |
| | | |
| | | xstring GetEntityID(LPARAM pr) |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row<1 || row>dw_list.GetRowCount()) return 0; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | if (!ele) return L""; |
| | | xstring id = GetEntityIDName(pr); |
| | | if (!ele.selectSingleNode(id)) return L""; |
| | | xstring d = ele.selectSingleNode(id).text(); |
| | | return d; |
| | | } |
| | | |
| | | xstring GetTaskID() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row<1 || row>dw_list.GetRowCount()) return 0; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | if (!ele) return L""; |
| | | xstring taskid = ele.getAttribute(L"taskid"); |
| | | return taskid; |
| | | } |
| | | |
| | | xstring GetReason(LPARAM pr, xstring comd) |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | if (GetEntityName(pr) == L"DeliveryDelay") |
| | | { |
| | | xstring ls_cmdid = comd;//pr; |
| | | int row = dw_list.GetRow(); |
| | | if (row < 1) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring ls_status = ele.selectSingleNode(L"@status").text(); |
| | | if (ls_status == L"货源部待确认" && ls_cmdid == L"action:bill.check.agree") |
| | | { |
| | | arg.AddArg(L"DDID", GetEntityID(2)); |
| | | arg.AddArg(L"_ModuelPage", L"dev:xpage[DeliveryDelay.supmancheck.vx]"); |
| | | OpenWindow(L"dev:xpage[vindexforold.vx]", arg); |
| | | //openUrl(L"/sale/view/DeliveryDelay/xpage/DeliveryDelay/supmancheck", arg); |
| | | if (arg.GetArgString(L"ret") == L"Sucess") |
| | | { |
| | | return L"Auto..."; |
| | | } |
| | | return L""; |
| | | } |
| | | else |
| | | { |
| | | //return frame::GetReason(pr); |
| | | arg.AddArg(L"EntityID", GetEntityID(2)); |
| | | arg.AddArg(L"_ModuelPage", L"dev:xpage[workflow.chkdlg.vx]"); |
| | | OpenWindow(L"dev:xpage[vindexforold.vx]", arg); |
| | | //int newArg2 = arg.ptr_native_; |
| | | //openUrl(L"/sale/view/workflow.view/xpage/chkdlg_vd", newArg2); |
| | | xstring comdid = arg.GetArgString(L"comdid"); |
| | | if (comdid == L"xmOK") |
| | | { |
| | | xstring value = arg.GetArgString(L"content") + L" "; |
| | | return value; |
| | | } |
| | | return L""; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //return frame::GetReason(pr); |
| | | arg.AddArg(L"EntityID", GetEntityID(2)); |
| | | OpenWindow(L"dev:xpage[workflow.chkdlg.vx]", arg); |
| | | //openUrl(L"/sale/view/workflow.view/xpage/chkdlg", arg); |
| | | xstring comdid2 = arg.GetArgString(L"comdid"); |
| | | if (comdid2 == L"xmOK") |
| | | { |
| | | xstring value2 = arg.GetArgString(L"content") + L" "; |
| | | return value2; |
| | | } |
| | | return L""; |
| | | |
| | | } |
| | | } |
| | | |
| | | int ViewUpdate(LPARAM pr, xstring updateItem, xaserverarg arg) |
| | | { |
| | | init(); |
| | | return 1; |
| | | } |
| | | |
| | | xstring GetEntityWorkNode(LPARAM pr, xstring what) |
| | | { |
| | | if (what == L"open") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 0; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring aurl = ele.selectSingleNode(L"@url").text(); |
| | | return aurl; |
| | | } |
| | | return L""; |
| | | } |
| | | |
| | | |
| | | int SetAgent() |
| | | { |
| | | if (dw_list) |
| | | { |
| | | //init(); |
| | | xstring id = GetEntityID(1); |
| | | if (id != L"") xframe::SetAgent((xstring)L"letter", id); |
| | | } |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | int openUrl(xstring aurl, /*param */ LPARAM para) |
| | | { |
| | | //alert(aurl); |
| | | xml x; |
| | | |
| | | xurl::get(aurl, L"", x); |
| | | KXMLDOMDocument doc = x; |
| | | KXMLDOMNode n = doc.selectSingleNode(L"//resource/@src"); |
| | | //alert(x.xml()); |
| | | if (n) |
| | | { |
| | | /* |
| | | xstring xq = n.text(); |
| | | OpenWindow(xq, para); |
| | | return 1; |
| | | */ |
| | | |
| | | xstring xq = n.text(); |
| | | if (doc.selectSingleNode(L"//resource/@argnative")) |
| | | { |
| | | OpenWindow(xq, para); |
| | | } |
| | | |
| | | //alert(xq); |
| | | else if (xq.find(L"upplier", 0) > 0 and xq != L"dev:xpage[Maint.SupplierStatusModify.vx]" and xq != L"dev:xpage[Maint.SupplierSubmit.vx]") |
| | | OpenWindow(xq, para); |
| | | else |
| | | { |
| | | xq = xq.replace(L"dev:xpage[", L""); |
| | | xq = xq.replace(L"]", L""); |
| | | xaserverarg& args = *(xaserverarg*)para; |
| | | args.AddArg(L"_ModuelPage", xq); |
| | | //alert(args.GetString()); |
| | | OpenWindow(L"dev:xpage[vindexforold.vx]", args); |
| | | } |
| | | return 1; |
| | | } |
| | | else |
| | | { |
| | | xaserverarg& arg = *(xaserverarg*)para; |
| | | n = doc.selectSingleNode(L"//resource[@vface!='' and @view!='']"); |
| | | if (n) |
| | | { |
| | | xstring vface = n.selectSingleNode(L"@vface").text(); |
| | | xstring view = n.selectSingleNode(L"@view").text(); |
| | | xstring config = n.selectSingleNode(L"@config").text(); |
| | | if (config != L"") |
| | | { |
| | | arg.AddArg(L"config", config, L"xs:xstring"); |
| | | } |
| | | if (vface == L"." || vface == L"") |
| | | { |
| | | xstring v = n.selectSingleNode(L"@url").text(); |
| | | xstring burl = aurl.mid(0, aurl.find(v, 0)); |
| | | //alert(burl); |
| | | return openUrl(burl + view, arg); |
| | | } |
| | | else |
| | | return openUrl(vface + L"/" + view, arg); |
| | | } |
| | | } |
| | | return -1; |
| | | } |
| | | |
| | | int SetTaskProcessed() |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | if (!dw_list.GetRowElement(row)) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | |
| | | xaserverarg arg; |
| | | |
| | | xstring taskid = ele.getAttribute(L"taskid"); |
| | | arg.AddArg(L"TaskID", taskid); |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/business/update/taskprocessed", L"TaskID", taskid); |
| | | if (x) alert(x.text()); |
| | | dw_list.DeleteRow(row); |
| | | |
| | | return 1; |
| | | } |
| | | int ProcessFlowAction(xstring comdid, LPARAM pr1) |
| | | { |
| | | if (comdid == L"__ModifyRows") |
| | | { |
| | | OnModifyRows(); |
| | | return 1; |
| | | } |
| | | |
| | | LPARAM pr = pr1; |
| | | xstring action = comdid.mid(comdid.find(L"action:", 0) + 7, 9999); |
| | | if (action == L"bill.delete" || action == L"bill.deleteEx") |
| | | { |
| | | if (MessageBox(GetHWND(), L"是否确定删除记录!", L"提示", 1) == 2) |
| | | return 1; |
| | | } |
| | | |
| | | if (action == L"bill.processed") |
| | | { |
| | | if (MessageBox(GetHWND(), L"是否确定选中的任务转已处理?", L"提示", 1) == 2) |
| | | return 1; |
| | | return SetTaskProcessed(); |
| | | } |
| | | |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"Action", action, L"xs:xstring"); |
| | | xml x; |
| | | |
| | | |
| | | xstring aurl = L"/workflow/query/actioninfo/" + action; |
| | | |
| | | if (xurl::get(aurl, L"", x) != 1) |
| | | return -1; |
| | | |
| | | int nlen; |
| | | int i = 0; |
| | | xstring name; |
| | | xstring worknode; |
| | | xstring how; |
| | | xstring state = L""; |
| | | xstring billstatus = L""; |
| | | KXMLDOMElement e; |
| | | |
| | | arg.AddArg(L"EntityName", GetEntityName(pr), L"xs:xstring"); |
| | | //参数要求 |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"//params/param"); |
| | | nlen = nlist.length(); |
| | | |
| | | for (i = 0; i < nlen; i++) |
| | | { |
| | | e = nlist.item(i); |
| | | name = e.selectSingleNode(L"@name").text(); |
| | | how = e.selectSingleNode(L"@how").text(); |
| | | |
| | | xstring content = L""; |
| | | if (how == L"Entity" || how == L"EntityData") |
| | | { |
| | | content = GetEntityData(pr); |
| | | } |
| | | if (e.selectSingleNode(L"@valid")) |
| | | { |
| | | if (content.find(L"update.modify", 0) > 0 || content.find(L"update.delete", 0) > 0) {} |
| | | else return 0; |
| | | if (CheckEntityValidity(pr) < 0) return -1; |
| | | } |
| | | if (how == L"EntityID") |
| | | arg.AddArg(name, GetEntityID(pr), L"xs:xstring"); |
| | | else if (how == L"Entity" || how == L"EntityData") |
| | | arg.AddArg(name, content, L"xs:xstring"); |
| | | else if (how == L"EntityRowData") |
| | | arg.AddArg(name, GetEntityRowData(pr), L"xs:xstring"); |
| | | else if (how == L"Reason") |
| | | { |
| | | arg.AddArg(name, GetReason(1, L""), L"xs:xstring"); |
| | | } |
| | | else if (how == L"EntityNo") |
| | | arg.AddArg(name, GetEntityNo(pr), L"xs:xstring"); |
| | | else if (how == L"EntityTitle") |
| | | arg.AddArg(name, GetEntityTitle(pr), L"xs:xstring"); |
| | | else if (how == L"GetParam") |
| | | arg.AddArg(name, GetParamValue(name), L"xs:xstring"); |
| | | else if (how == L"UserID") |
| | | arg.AddArg(name, xaserver::GetUserId(), L"xs:xstring"); |
| | | //"CHeckAskMsg" |
| | | //"CHeckMsg |
| | | if (how == L"Reason" && arg.GetArgString(name) == L"") return -1; |
| | | //if(how==L"EntityData" && arg.GetArgString(name)==L"") return -1; |
| | | if (e.selectSingleNode(L"@check")) |
| | | { |
| | | |
| | | xstring doCheck = e.selectSingleNode(L"@check").text(); |
| | | if (doCheck == L"Y") |
| | | { |
| | | xstring value = arg.GetArgString(name); |
| | | if (value == L"") |
| | | { |
| | | alert(name + L" 参数值不能为空,事件终止!"); |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | arg.AddArg(L"action.entity", GetEntityName(pr), L"xs:xstring"); |
| | | ProcessUsedArg(arg); |
| | | //动作 |
| | | KXMLDOMNode n = x.selectSingleNode(L"//view.action[1]"); |
| | | |
| | | bool execResult = true; //处理结果 |
| | | if (n) |
| | | { |
| | | name = n.selectSingleNode(L"@name").text(); |
| | | if (n.selectSingleNode(L"@worknode")) |
| | | worknode = n.selectSingleNode(L"@worknode").text(); |
| | | else |
| | | worknode = GetEntityWorkNode(pr, name); |
| | | arg.AddArg(L"do", name, L"xs:xstring"); |
| | | if (worknode != L"") |
| | | { |
| | | if (worknode.find(L"dev:xpage") == 0) |
| | | OpenWindow(worknode, arg); |
| | | else |
| | | openUrl(worknode, arg); //---openUrl(worknode,arg); |
| | | } |
| | | else |
| | | { |
| | | alert(L"Warn: Please configure worknode for action " + name + L"."); |
| | | return -1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //url::post(GetEntityName(pr)+L"/workflow/action",arg.GetString(),x); |
| | | xml x1; |
| | | int retxx = xurl::post(L"/workflow/action/" + GetEntityName(pr) + L"/" + action, arg.GetString(), x1); |
| | | |
| | | //alert(L"/workflow/action/"+GetEntityName(pr)+L"/"+action+L"\r\n"+arg.GetString()+L"\r\n"+x1.xml()); |
| | | |
| | | if (retxx != 1) execResult = false; |
| | | if (x1.selectSingleNode(L"//process")) |
| | | { |
| | | KXMLDOMElement e1 = x1.selectSingleNode(L"//process"); |
| | | xstring valid = e1.getAttribute(L"valid"); |
| | | xstring finished = e1.getAttribute(L"finished"); |
| | | xstring errInfo = L""; |
| | | if (valid == L"0") |
| | | { |
| | | errInfo = e1.getAttribute(L"errInfo"); |
| | | alert(errInfo); |
| | | execResult = false; |
| | | } |
| | | else if (finished == L"0") |
| | | { |
| | | errInfo = e1.getAttribute(L"errInfo"); |
| | | errInfo = L"处理失败!\r\n" + errInfo; |
| | | alert(errInfo); |
| | | execResult = false; |
| | | } |
| | | } |
| | | else if (x1.selectSingleNode(L"//process-check-list")) |
| | | { |
| | | KXMLDOMElement e2 = x1.selectSingleNode(L"//process-check-list"); |
| | | xstring val = e2.getAttribute(L"process"); |
| | | if (val == L"ok") |
| | | { |
| | | alert(L"处理成功"); |
| | | PostMessage(GetHWND(), 0x401, (WPARAM)L"action:bill.refresh", 0); |
| | | } |
| | | else if (val == L"part") |
| | | { |
| | | alert(L"有部分数据处理未成功,提交成功的已处理。"); |
| | | PostMessage(GetHWND(), 0x401, (WPARAM)L"action:bill.refresh", 0); |
| | | } |
| | | else |
| | | alert((xstring)L"数据处理不成功\r\n" + x1.xml()); |
| | | return 1; |
| | | } |
| | | else if (x1.selectSingleNode(L"//msg")) |
| | | { |
| | | xstring aStr = x1.selectSingleNode(L"//msg[1]").text(); |
| | | //if(aStr.find(L"理成功",0) < 0) |
| | | // alert(aStr); |
| | | if (aStr.find(L"失败", 0) >= 0) |
| | | execResult = false; |
| | | alert(aStr); |
| | | } |
| | | if (x1.selectSingleNode(L"//msg/@state")) |
| | | { |
| | | state = x1.selectSingleNode(L"//msg[1]/@state").text(); |
| | | arg.AddArg(L"state", state, L"xs:xstring"); |
| | | billstatus = x1.selectSingleNode(L"//msg[1]/@billstatus").text(); |
| | | arg.AddArg(L"billstatus", billstatus, L"xs:xstring"); |
| | | } |
| | | } |
| | | //更新要求 |
| | | if (execResult) |
| | | { |
| | | nlist = x.selectNodes(L"//view/update"); |
| | | nlen = nlist.length(); |
| | | for (i = 0; i < nlen; i++) |
| | | { |
| | | e = nlist.item(i); |
| | | how = e.selectSingleNode(L"@do").text(); |
| | | if (how == L"setstate") |
| | | { |
| | | if (state != L"") |
| | | { |
| | | arg.AddArg(L"state", state, L"xs:xstring"); |
| | | arg.AddArg(L"billstatus", billstatus, L"xs:xstring"); |
| | | ViewUpdate(pr, how, arg); |
| | | |
| | | } |
| | | } |
| | | else |
| | | ViewUpdate(pr, how, arg); |
| | | } |
| | | } |
| | | |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | |
| | | /*int ProcessFlowAction(xstring comdid, int pr1) |
| | | { |
| | | //trace(L"comdid---> %s\r\n", comdid); |
| | | if(comdid == L"__ModifyRows") |
| | | { |
| | | OnModifyRows(); |
| | | return 1; |
| | | } |
| | | |
| | | LPARAM pr = pr1; |
| | | xstring action = comdid.mid(comdid.find(L"action:",0)+7,9999); |
| | | if(action == L"bill.delete" || action == L"bill.deleteEx") |
| | | { |
| | | if (MessageBox(GetHWND(),L"是否确定删除记录!",L"提示1",1) == 2) |
| | | return 1; |
| | | } |
| | | |
| | | xaserverarg arg = new xaserverarg ; |
| | | |
| | | arg.AddArg(L"Action", action,L"xs:xstring"); |
| | | xml x ; |
| | | x.setNativePointer(xml ::CreateInstance()); |
| | | |
| | | xstring aurl = L"/workflow/query/actioninfo/"+action; |
| | | //trace(L"abc---",aurl); |
| | | |
| | | if(xurl::get(aurl, L"", x) != 1) |
| | | return -1; |
| | | //alert(x.xml()); |
| | | int nlen ; |
| | | int i = 0; |
| | | xstring name; |
| | | xstring worknode; |
| | | xstring how; |
| | | xstring state; |
| | | KXMLDOMElement e; |
| | | |
| | | arg.AddArg(L"EntityName", GetEntityName(pr),L"xs:xstring"); |
| | | //参数要求 |
| | | KXMLDOMNodeList nlist = x.selectNodes(L"//params/param"); |
| | | nlen = nlist.length; |
| | | |
| | | //trace(L"xxx"); |
| | | for(i=0; i<nlen; i++) |
| | | { |
| | | //trace(L"yyy"); |
| | | e = nlist.item(i); |
| | | //trace(e.xml); |
| | | name = e.selectSingleNode(L"@name").text(); |
| | | how = e.selectSingleNode(L"@how").text(); |
| | | //trace(how); |
| | | //trace(name); |
| | | xstring content = L""; |
| | | if(how==L"Entity" || how == L"EntityData") |
| | | content = GetEntityData(pr); |
| | | if(e.selectSingleNode(L"@valid")) |
| | | { |
| | | if(content.find(L"update.modify", 0) > 0 || content.find(L"update.delete",0) > 0) {} else return 0; |
| | | if(CheckEntityValidity(pr) < 0) return -1; |
| | | } |
| | | if(how==L"EntityID") |
| | | arg.AddArg(name, GetEntityID(pr),L"xs:xstring"); |
| | | else if(how==L"Entity" || how == L"EntityData") |
| | | arg.AddArg(name, content,L"xs:xstring"); |
| | | else if(how==L"EntityRowData") |
| | | arg.AddArg(name, GetEntityRowData(pr),L"xs:xstring"); |
| | | else if(how==L"Reason") |
| | | arg.AddArg(name, GetReason(pr, comdid),L"xs:xstring"); |
| | | else if(how==L"EntityNo") |
| | | arg.AddArg(name, GetEntityNo(pr),L"xs:xstring"); |
| | | else if(how==L"EntityTitle") |
| | | arg.AddArg(name, GetEntityTitle(pr),L"xs:xstring"); |
| | | else if(how==L"GetParam") |
| | | arg.AddArg(name, GetParamValue(name),L"xs:xstring"); |
| | | else if(how==L"UserID") |
| | | arg.AddArg(name, xaserver::GetUserId(),L"xs:xstring"); |
| | | //"CHeckAskMsg" |
| | | //"CHeckMsg |
| | | //trace(arg.GetString()); |
| | | //trace(arg.GetArgString(name)); |
| | | if(how==L"Reason" && arg.GetArgString(name)==L"") return -1; |
| | | //trace(L"cky1"); |
| | | //if(how==L"EntityData" && arg.GetArgString(name)==L"") return -1; |
| | | if(e.selectSingleNode(L"@check")) |
| | | { |
| | | |
| | | xstring doCheck = e.selectSingleNode(L"@check").text(); |
| | | if(doCheck == L"Y") |
| | | { |
| | | xstring value = arg.GetArgString(name); |
| | | if(value == L"") |
| | | { |
| | | alert(name + L" 参数值不能为空,事件终止!"); |
| | | return -1; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | arg.AddArg(L"action.entity",GetEntityName(pr),L"xs:xstring"); |
| | | //trace(L"zzz"); |
| | | //trace(arg.GetString()); |
| | | //动作 |
| | | KXMLDOMNode n = x.selectSingleNode(L"//view.action[1]"); |
| | | //trace(x.xml()); |
| | | bool execResult = true; //处理结果 |
| | | |
| | | if(n) |
| | | { |
| | | name = n.selectSingleNode(L"@name").text(); |
| | | if(n.selectSingleNode(L"@worknode")) |
| | | worknode = n.selectSingleNode(L"@worknode").text(); |
| | | else |
| | | worknode = GetEntityWorkNode(pr,name); |
| | | arg.AddArg(L"do",name,L"xs:xstring"); |
| | | if(worknode !=L"") |
| | | { |
| | | //trace(L"do:"+worknode); |
| | | int p = arg.ptr_native_; |
| | | openUrl(worknode,p); //---openUrl(worknode,arg); |
| | | } |
| | | else |
| | | { |
| | | alert(L"Warn: Please configure worknode for action "+ name +L"."); |
| | | return -1; |
| | | } |
| | | } |
| | | else |
| | | { |
| | | //url::post(GetEntityName(pr)+L"/workflow/action",arg.GetString(),x); |
| | | //trace(L"/workflow/action/"+GetEntityName(pr)+L"/"+action); |
| | | //trace(L"=====L"); |
| | | //trace(arg.GetString()); |
| | | xml x1 ; |
| | | x1.setNativePointer(xml::CreateInstance()); |
| | | int retxx = url::post(L"/workflow/action/"+GetEntityName(pr)+L"/"+action,arg.GetString(),x1); |
| | | if(retxx != 1) execResult = false; |
| | | //trace(x1.xml()); |
| | | if(x1.selectSingleNode(L"//msg")) |
| | | { |
| | | xstring aStr = L""+x1.selectSingleNode(L"//msg[1]").text(); |
| | | if(aStr.find(L"理成功",0) < 0) |
| | | alert(aStr); |
| | | if(aStr.find(L"失败",0) >= 0) |
| | | execResult = false; |
| | | trace(aStr); |
| | | } |
| | | if(x1.selectSingleNode(L"//msg/@state")) |
| | | { |
| | | state = x1.selectSingleNode(L"//msg[1]/@state").text(); |
| | | arg.AddArg(L"state",state,L"xs:xstring"); |
| | | } |
| | | } |
| | | //更新要求 |
| | | if(execResult) |
| | | { |
| | | nlist = x.selectNodes(L"//view/update"); |
| | | nlen = nlist.length; |
| | | for(i=0; i<nlen; i++) |
| | | { |
| | | e = nlist.item(i); |
| | | how = e.selectSingleNode(L"@do").text(); |
| | | //trace(how+L"444"+state); |
| | | if(how==L"setstate") |
| | | { |
| | | if(state != L"") |
| | | { |
| | | arg.AddArg(L"state",state,L"xs:xstring"); |
| | | ViewUpdate(pr,how,arg); |
| | | |
| | | } |
| | | } |
| | | else |
| | | ViewUpdate(pr,how,arg); |
| | | } |
| | | } |
| | | |
| | | |
| | | return 1; |
| | | } */ |
| | | |
| | | int BillPurchor() |
| | | { |
| | | int row1 = dw_list.GetRow(); |
| | | if (row1<0 || row1>dw_list.GetRowCount()) return 1; |
| | | if (!dw_list.GetRowElement(row1)) return 1; |
| | | KXMLDOMElement ele1 = dw_list.GetRowElement(row1); |
| | | xstring id1 = GetEntityIDName(1); |
| | | xstring d1 = ele1.selectSingleNode(id1).text(); |
| | | xstring name1 = GetEntityName(row1); |
| | | |
| | | xaserverarg arg1; |
| | | xstring templ = ele1.getAttribute(L"content2"); |
| | | xstring taskid = ele1.getAttribute(L"taskid"); |
| | | arg1.AddArg(L"template", templ); |
| | | arg1.AddArg(L"TaskID", taskid); |
| | | arg1.AddArg(L"EntityID", d1); |
| | | arg1.AddArg(L"bill.purchor", L"1"); |
| | | |
| | | OpenWindow(L"dev:xpage[QuoteFile.vx]", arg1); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | //命令发布函数 |
| | | int OnCmdDispatch(xstring comdid) |
| | | { |
| | | //alert(comdid); |
| | | xstring userno = publiccode::GetUser().no; |
| | | |
| | | if (comdid == L"action:bill.purchor") return BillPurchor(); |
| | | if (comdid == L"action:bill.check.agree") |
| | | { |
| | | int row3 = dw_list.GetRow(); |
| | | if (row3<0 || row3>dw_list.GetRowCount()) return 1; |
| | | if (!dw_list.GetRowElement(row3)) return 1; |
| | | KXMLDOMElement ele3 = dw_list.GetRowElement(row3); |
| | | xstring id3 = GetEntityIDName(1); |
| | | xstring d3 = ele3.selectSingleNode(id3).text(); |
| | | xstring name3 = GetEntityName(row3); |
| | | |
| | | if (name3 == L"SaleItem3") |
| | | { |
| | | xml x3; |
| | | xaserverarg arg3; |
| | | arg3.AddArg(L"SOLineID", d3); |
| | | if (getUrl(L"/sale/data/SaleOrder/UpdateSOLineTypeExS", arg3.GetString(), x3) != 1) |
| | | { |
| | | xstring error3 = x3.text(); |
| | | alert(L"err:" + error3); |
| | | return 1; |
| | | } |
| | | ProcessFlowAction(L"action:bill.check.agree", 1); |
| | | return 1; |
| | | } |
| | | } |
| | | if (userno == L"00601" || userno == L"00701" || userno == L"admin") |
| | | { |
| | | if (comdid == L"SourceRemark") |
| | | { |
| | | OnSourceRemark(); |
| | | return 1; |
| | | } |
| | | } |
| | | if (comdid == L"action:bill.check.agreeEx") |
| | | { |
| | | int row2 = dw_list.GetRow(); |
| | | if (row2<0 || row2>dw_list.GetRowCount()) return 1; |
| | | if (!dw_list.GetRowElement(row2)) return 1; |
| | | KXMLDOMElement ele2 = dw_list.GetRowElement(row2); |
| | | xstring id2 = GetEntityIDName(1); |
| | | xstring d2 = ele2.selectSingleNode(id2).text(); |
| | | xstring name2 = GetEntityName(row2); |
| | | |
| | | if (name2 == L"SaleItem3") |
| | | { |
| | | if (MessageBox(GetHWND(), L"是否确认 工厂付款?", L"提示1", 1) == 2) |
| | | return 1; |
| | | |
| | | xml x5; |
| | | xaserverarg arg5; |
| | | arg5.AddArg(L"SOLineID", d2); |
| | | if (getUrl(L"/sale/data/SaleOrder/UpdateSOLineTypeEx", arg5.GetString(), x5) != 1) |
| | | { |
| | | xstring error = x5.text(); |
| | | alert(L"err:" + error); |
| | | return 1; |
| | | } |
| | | alert(x5.text()); |
| | | ProcessFlowAction(L"action:bill.check.agree", 1); |
| | | return 1; |
| | | } |
| | | } |
| | | |
| | | if (comdid && comdid.find(L"hand!", 0) == 0) |
| | | { |
| | | if (comdid == L"hand!toleft") |
| | | { |
| | | ProcessFlowAction(L"action:bill.check.unagree", 1); |
| | | return 1; |
| | | } |
| | | if (comdid == L"hand!toright") |
| | | { |
| | | ProcessFlowAction(L"action:bill.check.agree", 1); |
| | | return 1; |
| | | } |
| | | if (comdid == L"hand!toupright") |
| | | { |
| | | int row = dw_list.GetRow(); |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | if (!dw_list.GetRowElement(row)) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = GetEntityIDName(1); |
| | | xstring d = ele.selectSingleNode(id).text(); |
| | | if (d == L"") return 1; |
| | | ProcessFlowAction(L"action:bill.open", 1); |
| | | return 1; |
| | | } |
| | | if (comdid == L"hand!round") |
| | | { |
| | | ProcessFlowAction(L"action:bill.note", 1); |
| | | return 1; |
| | | } |
| | | |
| | | } |
| | | if (comdid == L"xmIconNotifyClicked") |
| | | { |
| | | //OpenWindow(L"dev:xpage[/]",0); |
| | | init(); |
| | | return 1; |
| | | } |
| | | if (comdid == L"xmRefresh" || comdid == L"xmRefreshTask") |
| | | { |
| | | init(); |
| | | return 1; |
| | | } |
| | | if (ProcessFlowAction(comdid, 1) == 0) return 0; |
| | | if (comdid == L"action:bill.open") |
| | | { |
| | | int row1 = dw_list.GetRow(); |
| | | if (row1<0 || row1>dw_list.GetRowCount()) return 1; |
| | | if (!dw_list.GetRowElement(row1)) return 1; |
| | | KXMLDOMElement ele1 = dw_list.GetRowElement(row1); |
| | | xstring id1 = GetEntityIDName(1); |
| | | xstring d1 = ele1.selectSingleNode(id1).text(); |
| | | xstring name1 = GetEntityName(row1); |
| | | |
| | | if (name1 == L"QuoteEnquiry") |
| | | { |
| | | xaserverarg arg1; |
| | | xstring templ = ele1.getAttribute(L"content2"); |
| | | xstring taskid = ele1.getAttribute(L"taskid"); |
| | | arg1.AddArg(L"template", templ); |
| | | arg1.AddArg(L"TaskID", taskid); |
| | | arg1.AddArg(L"EntityID", d1); |
| | | |
| | | OpenWindow(L"dev:xpage[QuoteFile.vx]", arg1); |
| | | return 1; |
| | | } |
| | | if (name1 == L"SampleFee") |
| | | { |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"SampleFeeID", d1); |
| | | //arg.AddArg(L"HWND",GetHWND().toString()); |
| | | OpenWindow(L"dev:xpage[maint.samplefee.vx]", arg); |
| | | return 1; |
| | | } |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | int OnSourceRemark() |
| | | { |
| | | xstring name = L"事务处理"; |
| | | xml x = ViewObject::RetrieveData(L"/sale/data/TradeFinance3/GetSetUpRemarks", L"Type", name); |
| | | KXMLDOMNodeList items = x.selectNodes(L"data/Item"); |
| | | KXMLDOMNode t = items.item(0); |
| | | xstring Content = L""; |
| | | if (t.selectSingleNode(L"Content")) |
| | | { |
| | | Content = t.selectSingleNode(L"Content").text(); |
| | | } |
| | | xaserverarg arg1; |
| | | arg1.AddArg(L"value", Content); |
| | | OpenWindow(L"dev:xpage[memo.edit.new.vx]", arg1); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnDoubleClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | if (!dw_list.GetRowElement(row)) return 1; |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | xstring id = GetEntityIDName(1); |
| | | xstring d = ele.selectSingleNode(id).text(); |
| | | if (d == L"") return 1; |
| | | |
| | | xstring name1 = GetEntityName(1); |
| | | if (name1 == L"QuoteEnquiry") |
| | | { |
| | | xaserverarg arg1; |
| | | xstring templ = ele.getAttribute(L"content2"); |
| | | xstring taskid = ele.getAttribute(L"taskid"); |
| | | //trace(templ); |
| | | arg1.AddArg(L"template", templ); |
| | | arg1.AddArg(L"TaskID", taskid); |
| | | arg1.AddArg(L"EntityID", d); |
| | | |
| | | OpenWindow(L"dev:xpage[QuoteFile.vx]", arg1); |
| | | return 1; |
| | | } |
| | | |
| | | ProcessFlowAction(L"action:bill.open", 1); |
| | | return 1; |
| | | } |
| | | |
| | | //焦点激活处理函数 |
| | | int OnSetFocus(TEvent* evt, LPARAM param) |
| | | { |
| | | SetAgent(); |
| | | //重置工具条 |
| | | return 1; |
| | | } |
| | | |
| | | //命令处理事件 |
| | | int OnXCommand(TEvent* evt, LPARAM p) |
| | | { |
| | | return OnCmdDispatch(evt->xcommand.pStrID); |
| | | } |
| | | |
| | | int ShowDetail(int row) |
| | | { |
| | | |
| | | if (row<0 || row>dw_list.GetRowCount()) return 1; |
| | | |
| | | if (!dw_list.GetRowElement(row)) return 1; |
| | | |
| | | |
| | | |
| | | KXMLDOMElement ele = dw_list.GetRowElement(row); |
| | | trace((xstring)L"\r\n====113======L" + ele.xml()); |
| | | dw_list.SetRow(row); |
| | | if (GetEntityID(1) == L"") return -1; |
| | | |
| | | //trace(ele.xml); |
| | | xaserverarg arg; |
| | | |
| | | arg.AddArg(L"content", ele.xml()); |
| | | xml doc; |
| | | |
| | | if (getUrl(L"/sale/data/vpage/vstart/task", arg.GetString(), doc) != 1) |
| | | { |
| | | trace((xstring)L"error->:" + doc.xml()); |
| | | return 0; |
| | | } |
| | | //trace(L"----1111----"); |
| | | if ((xstring)doc.xml() == L"") |
| | | return -1; |
| | | |
| | | //trace(doc.xml()); |
| | | |
| | | xshtml ht = GetControl(L"taskinfo"); |
| | | ht.SetContent(doc.xml()); |
| | | ht.Redraw(); |
| | | |
| | | //xframe::SetAgent((xstring)L"letter", GetEntityID(1)); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnClicked(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | |
| | | trace(L"count:" + (xstring)dw_list.GetRowCount()); |
| | | if (row<1 || row>dw_list.GetRowCount()) return 1; |
| | | |
| | | trace(L"\r\n-------" + (xstring)row); |
| | | |
| | | if (ShowDetail(row) != 1) |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | this->SetAgentNode(anode, L"<vbox/>"); |
| | | } |
| | | else |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int OnRowChanged(TEvent* evt, LPARAM p) |
| | | { |
| | | DWNMHDR& hdr = *(DWNMHDR*)evt->notify.pnmh; |
| | | int row = hdr.row; |
| | | if (row<0 || row>dw_list.GetRowCount()) return 0; |
| | | trace(L"\r\n-----222------"); |
| | | if (ShowDetail(row) != 1) |
| | | { |
| | | xstring xfNodeAgentArea = L"agentarea"; |
| | | xnode anode = GetAgentNode(xfNodeAgentArea); |
| | | this->SetAgentNode(anode, L"<vbox/>"); |
| | | } |
| | | else |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onload() |
| | | { |
| | | dw_list = GetControl(L"tasklist"); |
| | | init(); |
| | | { |
| | | //alert(L"xxxxxxxxxxx"); |
| | | //SetAgent(); |
| | | //AttachEvent(L"WM_SETFOCUS", (FEvent)&startvframevbusiness::OnSetFocus); |
| | | //绑定工具条点击事件 |
| | | AttachEvent(L"WM_XCOMMAND", (FEvent)&startvframevbusiness::OnXCommand); |
| | | //AttachEvent(L"WM_TIMER",OnTimer); |
| | | AttachEvent(L"tasklist", L"DWV_ROWFOCUSCHANGED", (FEvent)&startvframevbusiness::OnRowChanged); |
| | | AttachEvent(L"tasklist", L"DWV_DOUBLECLICKED", (FEvent)&startvframevbusiness::OnDoubleClicked); |
| | | AttachEvent(L"tasklist", L"DWV_CLICKED", (FEvent)&startvframevbusiness::OnClicked); |
| | | |
| | | OnAttachListon(); |
| | | dw_list = GetControl(L"tasklist"); |
| | | |
| | | init(); |
| | | |
| | | SetAgent(); |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | int onloaded() |
| | | { |
| | | return 1; |
| | | } |
| | | }; |
| | |
| | | |
| | | |
| | | |
| | | |