238 lines
10 KiB
Plaintext
238 lines
10 KiB
Plaintext
<%@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 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'";
|
|
//产品组件关键字
|
|
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();
|
|
|
|
%>
|
|
<html>
|
|
<head>
|
|
<title></title>
|
|
</head>
|
|
<body class=pagebackground leftmargin="0" topmargin="0" >
|
|
<table align='center' width='100%' cellspacing="4" cellpadding="0">
|
|
|
|
<%
|
|
List<BusinessObject> componentList = XMLHelper.getBusinessObjectList(xmlComponentFile, xmlComponentTags, componentKeys);
|
|
//List<BusinessObject> existProducts = XMLHelper.getBusinessObjectList(xmlConfigFile, xmlConfigTags, configKeys);
|
|
BizObject boLPI = JBOFactory.getBizObjectManager(LB_PRODUCT_INFO.CLASS_NAME).createQuery("ID=:ID").setParameter("ID", xmlConfigFile).getSingleResult(false);
|
|
List<BusinessObject> existProducts = new ArrayList<BusinessObject>();
|
|
if(boLPI != null){
|
|
String pData = boLPI.getAttribute("PRODUCT_DATA").getString();
|
|
if("".equals(pData)){
|
|
}else{
|
|
JSONArray jsonArray = JSONArray.fromObject(pData);
|
|
Iterator<JSONObject> it = jsonArray.iterator();
|
|
while(it.hasNext()){
|
|
BusinessObject b = BusinessObject.createBusinessObject("Component");
|
|
b.setAttributes((JSONObject)it.next().get("jbo.sample.Component"));
|
|
existProducts.add(b);
|
|
}
|
|
}
|
|
}
|
|
List<BusinessObject> boList = XMLHelper.getBusinessObjectList(xmlFile, xmlTags, keys);
|
|
|
|
for(int i = 0; i < boList.size(); i ++){
|
|
BusinessObject bo = boList.get(i);
|
|
|
|
List<BusinessObject> boComponentList = BusinessObjectHelper.getBusinessObjectsBySql(componentList, "Type like :Type", "Type",bo.getString("ID"));
|
|
if(boComponentList == null || boComponentList.isEmpty()) continue;
|
|
%>
|
|
|
|
<DIV id=A_Group_<%=i %>>
|
|
<TABLE class="info_data_tablecommon info_group_table" width="100%">
|
|
<TBODY>
|
|
<TR>
|
|
<TD class=info_group_backgourd_l width=10> </TD>
|
|
<TD class="info_group_backgourd_2 info_group_backgourd_3" width=10><SPAN onclick=try{changeExpand(this)}catch(e){}; id=EXP_<%=i%> groupid="<%=i%>" type="EXPAND"></SPAN><SPAN onclick="showHideContent('<%=i%>')" id=imgexpand<%=i%> class=info_group_expand expand="1"> </SPAN></TD>
|
|
<TD onclick="showHideContent('<%=i%>')" class=info_group_backgourd_2 width="100%"><SPAN id=Group_<%=i%> class=info_group_title style="WIDTH: 100%"><SPAN id=Group_Title_<%=i%>><%=bo.getString("NAME")%></SPAN></SPAN></TD>
|
|
<TD class=info_group_backgourd_r></TD></TR></TBODY></TABLE>
|
|
<TABLE id=@SysSub<%=i%> cellSpacing=0 cellPadding=0 width="100%" border=0>
|
|
<TBODY>
|
|
<TR>
|
|
<TD class=info_2side_border>
|
|
<TABLE class=table_line cellSpacing=0 cellPadding=0 width="100%" bgColor=#ffffff border=0>
|
|
<TBODY>
|
|
|
|
|
|
<TR>
|
|
|
|
|
|
<%
|
|
|
|
xmlConfigFile = StringHelper.replaceString(xmlConfigFile,bo);
|
|
configKeys = StringHelper.replaceString(configKeys,bo);
|
|
List<BusinessObject> exists = BusinessObjectHelper.getBusinessObjectsBySql(existProducts, "Type like :Type", "Type",bo.getString("ID"));
|
|
|
|
int cnt = 0;
|
|
for(int j=0;j<boComponentList.size();j++){
|
|
BusinessObject term = boComponentList.get(j);
|
|
String termID = term.getString("ID");
|
|
String format = term.getString("Format");
|
|
String termName = term.getString("Name");
|
|
|
|
//修改,避免新增产品时无法取到
|
|
List<BusinessObject> ls = BusinessObjectHelper.getBusinessObjectsBySql(exists, "ID=:ID", "ID",term.getString("ID"));
|
|
boolean selected = (ls != null && !ls.isEmpty());
|
|
cnt++;
|
|
%>
|
|
<TD width="20%" nowrap>
|
|
<DIV id=A_div_<%=i %>_<%=j %>>
|
|
<input type="checkbox" name="<%=termID%>_CheckBox" value="<%=termID%>" <%= !selected ?"":"checked"%> onclick=doSelect("<%=termID%>")>
|
|
<%=termName%>
|
|
<a name="<%=termID%>_Link" onclick=editProductTermPara("<%=termID%>","<%=format %>","<%=termName%>","<%=bo.getString("ID")%>") style="display:<%= !selected ?"none":""%>">
|
|
<font color=blue><b>编辑参数</b></font></a>
|
|
<td>
|
|
<%
|
|
if((cnt)%5==0 )
|
|
{
|
|
%>
|
|
</tr>
|
|
<tr>
|
|
<%
|
|
}
|
|
}
|
|
%>
|
|
</DIV>
|
|
</TD></TR>
|
|
|
|
</TBODY></TABLE></TD></TR>
|
|
<TR>
|
|
<TD height=13 vAlign=top>
|
|
<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
|
|
<TBODY>
|
|
<TR>
|
|
<TD class=info_bottom_line_left vAlign=top width="50%" align=left></TD>
|
|
<TD class=info_bottom_line_right vAlign=top width="50%" align=right></TD></TR></TBODY></TABLE></TD></TR>
|
|
</TBODY>
|
|
</TABLE>
|
|
</DIV>
|
|
|
|
<%
|
|
}
|
|
%>
|
|
|
|
</table>
|
|
</body>
|
|
</html>
|
|
<script language="javascript">
|
|
//用以控制几个条件区的显示或隐藏
|
|
function showHideContent(id)
|
|
{
|
|
var obj = document.all("imgexpand"+id);
|
|
var tableid = "@SysSub"+id;
|
|
if(!obj.expand || obj.expand=="1"){
|
|
obj.expand = "0";
|
|
obj.className = "info_group_collapse";
|
|
if(document.getElementById(tableid))
|
|
document.getElementById(tableid).style.display = "none";
|
|
}
|
|
else{
|
|
obj.expand = "1";
|
|
obj.className = "info_group_expand";
|
|
if(document.getElementById(tableid))
|
|
document.getElementById(tableid).style.display = "";
|
|
}
|
|
|
|
}
|
|
|
|
function doSelect(id){
|
|
var isCheck = document.all(id+"_CheckBox").checked;
|
|
if(isCheck){
|
|
document.all(id+"_Link").style.display='';
|
|
var result = RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductSpecificManager", "importComponents",
|
|
"SpecificSerialNo=<%=specificSerialNo%>,ComponentID="+id +",FromXMLFile=<%=xmlComponentFile%>,FromXMLTags=Component,Keys=ID,userID=<%=userID%>,orgID=<%=orgID%>");
|
|
if(result == "true"){
|
|
document.all(id+"_Link").style.display='';
|
|
}else if(result == "false"){
|
|
document.all(id+"_Link").style.display='none';
|
|
}
|
|
}else{
|
|
document.all(id+"_Link").style.display='none';
|
|
RunJavaMethodTrans("com.amarsoft.app.als.prd.manager.ProductSpecificManager", "deleteComponents","SpecificSerialNo=<%=specificSerialNo%>,XMLTags=Component,Keys=ID,ComponentID="+id);
|
|
}
|
|
}
|
|
|
|
|
|
function editProductTermPara(id,format,name,type){
|
|
if("3" == format){
|
|
AsDialog.PopPage("/ProductManage/ComponentConfig/ComponentLibraryList.jsp","XMLFile=<%=xmlConfigFile%>&XMLTags=Component||ID='"+id+"'//ChildrenComponents//ChildrenComponent||1=1&Keys=<%=keys%>&ComponentID="+id+"&Format="+format+"&ComponentRightType=PRightType","dialogWidth:900px;dialogHeight:400px;resizable=no;scrollbars=yes;status:yes;maximize:no;help:no;",function(){},name);
|
|
}else if(format == "4"){
|
|
AsDialog.PoPage("/ProductManage/ComponentConfig/ComponentScoreCard.jsp","XMLFile=<%=xmlConfigFile%>&XMLTags=Component||ID='"+id+"'&Keys=<%=keys%>&ComponentID="+id+"&Format="+format+"&ComponentRightType=PRightType","dialogWidth:1200px;dialogHeight:600px;",function(){},name);
|
|
}else if(id == "DocList"){
|
|
AsDialog.PopPage("/ProductManage/ComponentConfig/UpDownComponent.jsp","XMLFile=<%=xmlConfigFile%>&XMLTags=Component||ID='"+id+"'&Keys=<%=keys%>&ComponentID="+id+"&Format="+format+"&ComponentRightType=PRightType&RightType=All&productid=<%=productID%>","dialogWidth:1000px;dialogHeight:600px;resizable=no;scrollbars=yes;status:yes;maximize:no;help:no;",function(){},name);
|
|
}else if(type == "PRD0330"){
|
|
AsDialog.PopPage("/ProductManage/ComponentConfig/ComponentRuleCalc.jsp","XMLFile=<%=xmlConfigFile%>&XMLTags=Component||ID='"+id+"'&Keys=<%=keys%>&ComponentID="+id+"&Format="+format+"&ComponentRightType=PRightType&RightType=All&productid=<%=productID%>","dialogWidth:1000px;dialogHeight:600px;resizable=no;scrollbars=yes;status:yes;maximize:no;help:no;",function(){},name);
|
|
}else{
|
|
AsDialog.PopPage("/ProductManage/ComponentConfig/ComponentRule.jsp","XMLFile=<%=xmlConfigFile%>&XMLTags=Component||ID='"+id+"'&Keys=<%=keys%>&ComponentID="+id+"&Format="+format+"&ComponentRightType=PRightType&RightType=All","dialogWidth:900px;dialogHeight:400px;resizable=no;scrollbars=yes;status:yes;maximize:no;help:no;",function(){},name);
|
|
}
|
|
}
|
|
</script>
|
|
<%@ include file="/Frame/resources/include/include_end.jspf"%> |