%@page import="com.tenwa.reckon.util.UUIDUtil"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="net.sf.json.JSONArray"%>
<%@page import="java.util.Iterator"%>
<%@page import="jbo.sys.LB_PRODUCT_INFO"%>
<%@ page contentType="text/html; charset=GBK"%>
<%@page import="com.amarsoft.app.base.util.XMLHelper,
com.amarsoft.app.base.util.StringHelper,
com.amarsoft.app.base.businessobject.*,
javax.xml.parsers.DocumentBuilderFactory,
javax.xml.transform.Transformer,
javax.xml.transform.TransformerFactory,
javax.xml.transform.dom.DOMSource,
javax.xml.transform.stream.StreamResult,jbo.prd.PRD_SPECIFIC_LIBRARY"%>
<%@ include file="/Frame/resources/include/include_begin_info.jspf"%>
<%
String specificSerialNo = CurPage.getParameter("SpecificSerialNo");
String productID = CurPage.getParameter("ProductID");
String productType2 = CurPage.getParameter("ProductType2");
//产品组件类型文件
String xmlFile = "{$ARE.PRD_HOME}/etc/app/component/componenttype-config.xml";
xmlFile = ARE.replaceARETags(xmlFile);
//产品组件类型筛选条件
String xmlTags = "ComponentType||ID like 'PRD' and Status = '1' and length(ID)=7";
//产品组件类型关键字
String keys = "ID";
//产品组件基础文件
String xmlComponentFile = "{$ARE.PRD_HOME}/etc/app/component/component-config.xml";
xmlComponentFile = ARE.replaceARETags(xmlComponentFile);
//产品组件筛选条件
String xmlComponentTags = "Component||Status='1' and PRODUCT_TYPE like '" + productType2 + "'";
//产品组件关键字
String componentKeys = "ID";
BusinessObjectManager bomanager = BusinessObjectManager.createBusinessObjectManager();
BusinessObject specific = bomanager.keyLoadBusinessObject(PRD_SPECIFIC_LIBRARY.CLASS_NAME, specificSerialNo);
//产品组件规格文件
String xmlConfigFile = specific.getString("ConfigFile");
if(StringX.isEmpty(xmlConfigFile) || xmlConfigFile.endsWith(".xml"))
{
xmlConfigFile = UUIDUtil.getUUID();
specific.setAttributeValue("ConfigFile", xmlConfigFile);
bomanager.updateBusinessObject(specific);
bomanager.updateDB();
}
/*xmlConfigFile = ARE.replaceARETags(xmlConfigFile);
File f = new File(xmlConfigFile);
if(!f.exists())
{
TransformerFactory tFactory=TransformerFactory.newInstance();
Transformer transformer=tFactory.newTransformer();
//设置输出的encoding为改变gbk
transformer.setOutputProperty("encoding",ARE.getProperty("CharSet","GBK"));
org.w3c.dom.Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
org.w3c.dom.Element e = document.createElement("Components");
document.appendChild(e);
DOMSource source= new DOMSource(document);
StreamResult result = new StreamResult(xmlConfigFile);
transformer.transform(source,result);
} */
//产品组件规格筛选条件
String xmlConfigTags = "Component";
//产品组件规格关键字
String configKeys = "ID";
//当前登录人
String userID = CurUser.getUserID();
//当前登录人部门
String orgID = CurUser.getOrgID();
%>
<%
List componentList = XMLHelper.getBusinessObjectList(xmlComponentFile, xmlComponentTags, componentKeys);
//List existProducts = XMLHelper.getBusinessObjectList(xmlConfigFile, xmlConfigTags, configKeys);
BizObject boLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME).createQuery("ID=:ID").setParameter("ID", xmlConfigFile).getSingleResult(false);
List existProducts = new ArrayList();
if(boLPI != null){
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();
if("".equals(pData)){
}else{
JSONArray jsonArray = JSONArray.fromObject(pData);
Iterator it = jsonArray.iterator();
while(it.hasNext()){
BusinessObject b = BusinessObject.createBusinessObject("Component");
b.setAttributes((JSONObject)it.next().get("jbo.sample.Component"));
existProducts.add(b);
}
}
}
List boList = XMLHelper.getBusinessObjectList(xmlFile, xmlTags, keys);
for(int i = 0; i < boList.size(); i ++){
BusinessObject bo = boList.get(i);
List boComponentList = BusinessObjectHelper.getBusinessObjectsBySql(componentList, "Type like :Type", "Type",bo.getString("ID"));
if(boComponentList == null || boComponentList.isEmpty()) continue;
%>
>
| |
groupid="<%=i%>" type="EXPAND"> class=info_group_expand expand="1"> |
class=info_group_title style="WIDTH: 100%">><%=bo.getString("NAME")%> |
|
cellSpacing=0 cellPadding=0 width="100%" border=0>
<%
xmlConfigFile = StringHelper.replaceString(xmlConfigFile,bo);
configKeys = StringHelper.replaceString(configKeys,bo);
List exists = BusinessObjectHelper.getBusinessObjectsBySql(existProducts, "Type like :Type", "Type",bo.getString("ID"));
int cnt = 0;
for(int j=0;j ls = BusinessObjectHelper.getBusinessObjectsBySql(exists, "ID=:ID", "ID",term.getString("ID"));
boolean selected = (ls != null && !ls.isEmpty());
cnt++;
%>
|
|
<%
}
}
%>
|
|
|
<%
}
%>
<%@ include file="/Frame/resources/include/include_end.jspf"%>