| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- //package xin.glue.ui.G.G02;
- //
- //import java.io.File;
- //import java.util.Iterator;
- //import java.util.Map;
- //import java.util.Set;
- //
- //import javax.xml.parsers.DocumentBuilder;
- //import javax.xml.parsers.DocumentBuilderFactory;
- //
- //import org.w3c.dom.Document;
- //import org.w3c.dom.Node;
- //import org.w3c.dom.NodeList;
- //
- //import com.posdata.glue.PosException;
- //import com.posdata.glue.biz.activity.PosActivity;
- //import com.posdata.glue.biz.constants.PosBizControlConstants;
- //import com.posdata.glue.context.PosContext;
- //import com.posdata.glue.dao.PosDaoException;
- //import com.posdata.glue.dao.PosGenericDao;
- //import com.posdata.glue.dao.vo.PosParameter;
- //import com.posdata.glue.dao.vo.PosRow;
- //import com.posdata.glue.dao.vo.PosRowSet;
- //
- ///**
- // *
- // * 炼刚成分实绩查询
- // * @author 梅贵平
- // * @date 2008-9-21
- // */
- //public class FindChem extends PosActivity
- //{
- // private PosGenericDao dao = this.getDao("mesdao");
- // public String runActivity(PosContext context)
- // {
- // try
- // {
- // String[]chem = getChem();//获得所有成分
- // StringBuffer buffer0 = new StringBuffer();//用于替代{0}
- // StringBuffer buffer1 = new StringBuffer();//用于替代{1}
- // StringBuffer buffer2 = new StringBuffer();//用于替代{2}
- // StringBuffer buffer3 = new StringBuffer();//用于替代{3}
- //
- // if(chem!=null)
- // {
- // for(int i=0; i < chem.length; i++)
- // {
- // buffer0.append(" , "+chem[i]);//{0}被其替换
- // buffer1.append(" , "+" max(decode(CHEM_CD, '"+chem[i] +"' ,CHEM_MIN,NULL)) "+ chem[i]);//{1}被其替换
- // buffer2.append(" , "+" max(decode(CHEM_CD, '"+chem[i] +"' ,CHEM_MAX,NULL)) "+ chem[i]);//{2}被其替换
- // buffer3.append(" , "+" max(decode(CHEM_CD, '"+chem[i] +"' ,CHEM_VAL,NULL)) "+ chem[i]);//{3}被其替换
- // }
- //
- // DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- // factory.setValidating(false);// 是否使用DTD,Schemal来校验
- // DocumentBuilder build = factory.newDocumentBuilder();
- // Document doc = build.parse(new File("webapps\\xgmes3\\WEB-INF\\classes\\sql.xml"));
- //
- // NodeList nl = doc.getElementsByTagName("sql001");
- // Node n = nl.item(0);
- //
- //// String str = n.getTextContent().trim();
- // String str = n.getNodeValue().trim();
- // str = str.replaceAll("[{]+[0]+[}]+", buffer0.toString());//替代{0}
- // str = str.replaceAll("[{]+[1]+[}]+", buffer1.toString());//替代{1}
- // str = str.replaceAll("[{]+[2]+[}]+", buffer2.toString());//替代{2}
- // str = str.replaceAll("[{]+[3]+[}]+", buffer3.toString());//替代{3},形成最终的sql
- //
- // String[]CHARGE_NO = (String[])context.get("CHARGE_NO");//炉次号
- // String[]SUBPROC = (String[])context.get("SUBPROC");//工序,如转炉(B),CAS(C)
- // PosParameter param= new PosParameter();
- // param.setWhereClauseParameter(0, CHARGE_NO[0]);
- // param.setWhereClauseParameter(1, CHARGE_NO[0]);
- // param.setWhereClauseParameter(2, CHARGE_NO[0]);
- // param.setWhereClauseParameter(3, SUBPROC[0]);
- // PosRowSet rowset = dao.findByQueryStatement(str, param);
- // context.put("BofChemResult", rowset);
- // }
- //
- // }
- // catch(Exception e)
- // {
- // e.printStackTrace();
- // throw new PosDaoException(e.toString());
- // }
- //
- // return PosBizControlConstants.SUCCESS;
- // }
- //
- // //返回所有化学成分
- // public String[] getChem()
- // {
- // String sqlChem ="SELECT DISTINCT upper(CHEM_CD) FROM TBB01_FAC_INGR";
- // PosRowSet rowset = dao.findByQueryStatement(sqlChem);
- // PosRow row = null;
- // Map map = null;
- // Set set = null;
- // Iterator it= null;
- // String key = null;
- // int i =0;
- // String[]str = new String[rowset.count()];//存储成分
- // while(rowset.hasNext())
- // {
- // row = rowset.next();
- // map = row.getAttributes();
- // set = map.keySet();
- // it = set.iterator();
- // while(it.hasNext())
- // {
- // key = (String)it.next();
- // str[i++] = map.get(key).toString();
- // }
- // }
- // return str;
- // }
- //}
|