GUI根据单据id打开对应单据web页面代码原创
金蝶云社区-zhiwei_xing
zhiwei_xing
3人赞赏了该文章 577次浏览 未经作者许可,禁止转载编辑于2021年04月15日 14:30:51


String billId = getSelectedKeyValue();
if (!(StringUtils.isEmpty(billId))) {
    boolean webSupportOnly = MessageUtil.isWebSupportOnly(billId);
    if (webSupportOnly) {
        String serverURL = System.getProperty("UPDATE_SERVER_ADDR");
        if (StringUtils.isEmpty(serverURL))
            serverURL = "http://localhost:6888";
        else {
            serverURL = "http://" + serverURL;
        }
        IWebViewMessageFacade webViewFacade = WebViewMessageFacadeFactory.getRemoteInstance();
        String toUrl = webViewFacade.getUrlByBillID(billId);
        if (!(StringUtils.isEmpty(toUrl))) {
            if (toUrl.indexOf("?") > 0)
                toUrl = toUrl + "&billId=" + URLEncoder.encode(billId, "utf-8");
            else {
                toUrl = toUrl + "?billId=" + URLEncoder.encode(billId, "utf-8");
            }
 
            if (toUrl.indexOf("pureWFBillUrl") < 0) {
                toUrl = "/easweb/" + toUrl;
            }
            toUrl = URLEncoder.encode(toUrl, "utf-8");
            String url = serverURL + "/portal/" + SSOHandleFacadeFactory.getRemoteInstance().getGUItoPortalUrl(toUrl, true, SysContext.getSysContext().getLocale().toString(), SysContext.getSysContext().getDCNumber());
            url = replaceAllStr(url, "&", "^&");
            NewWinMainUI.gotoSite(url);
        } else {
            MsgBox.showInfo(this, EASResource.getString("com.kingdee.eas.base.message.client.MessageCenter", "can.not.surrport.open"));
            return;
        }
    }
}
 
private static String replaceAllStr(String strSource, String strFrom, String strTo) {
    if (strFrom == null || strFrom.equals(""))
        return strSource;
    String strDest = "";
    int intFromLen = strFrom.length();
    int intPos = 0;
    while ((intPos = strSource.indexOf(strFrom)) != -1) {
        strDest = (new StringBuilder()).append(strDest).append(strSource.substring(0, intPos)).toString();
        strDest = (new StringBuilder()).append(strDest).append(strTo).toString();
        strSource = strSource.substring(intPos + intFromLen);
    }
    strDest = (new StringBuilder()).append(strDest).append(strSource).toString();
    return strDest;
}

    

赞 3