package xin.glue.ui.B.B02; 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.PosGenericDao; import com.posdata.glue.dao.vo.PosParameter; import com.posdata.glue.dao.vo.PosRow; import com.posdata.glue.dao.vo.PosRowSet; /** * * @Description 炉次替代钢号,获得不合格炉次号成分信息{界面ID:UIB020050} * @author 梅贵平{meiguiping} * @date 2009-2-4 上午11:24:37 * @JDK Version jdk1.4.2 */ public class FindUnqualifiedCharge extends PosActivity { public String runActivity(PosContext context) { ///ready PosGenericDao dao = this.getDao("mesdao"); PosParameter param = null; PosRowSet rowset = null; MutilConditionFind mcf = new MutilConditionFind(); ///get request data String[] CHARGENO = (String[])context.get("CHARGENO");//炉次号 ///获得满足条件的成分代码 param = new PosParameter(); param.setWhereClauseParameter(0, CHARGENO[0]); rowset = dao.find("UIB020050_01.SELECT", param); context.put("ChemNM", rowset); ///通过循环,获取SQL语句,并执行 PosRow row = null; String temp= ""; String repl= mcf.getQuerySql("UIB020050_02_01.LOOP").toString(); StringBuffer sb = new StringBuffer(350); int j = 1; while(rowset.hasNext()) { row = rowset.next(); temp = repl.replaceFirst("[{]+[0]+[}]+", row.getAttribute("CHEM_CD").toString()); temp = temp.replaceFirst("[{]+[1]+[}]+", new Integer(j++).toString()); sb.append(temp); } //生成最终需要的SQL语句 String sql = mcf.getQuerySql("UIB020050_02.SELECT").toString().replaceFirst("[{]+[0]+[}]+", sb.toString()); param = new PosParameter(); param.setWhereClauseParameter(0, CHARGENO[0]); rowset = dao.findByQueryStatement(sql, param); context.put("ErrorCharge", rowset); return PosBizControlConstants.SUCCESS; } }