package xin.glue.ui.B.B02; import java.sql.CallableStatement; import java.sql.SQLException; 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.PosRowSet; /** * * @Description 炉次或板坯牌号改判{界面ID:UIB020050} * @author 梅贵平{meiguiping} * @date 2009-4-8 下午04:20:36 * @JDK Version jdk1.4.2 */ public class SaveChangeStlGrd extends PosActivity { public String runActivity(PosContext context) { PosGenericDao dao = this.getDao("mesdao"); PosRowSet rowset = null; PosParameter param = null; CallableStatement cstm= null; String[] rowStatus = (String[])context.get("rowStatus"); String[] CHARGE_NO = (String[])context.get("CHARGE_NO");//炉号或板坯号 String[] INFO = (String[])context.get("INFO");//S为板坯,C为炉次 String[] STL_GRD = (String[])context.get("STL_GRD");//厂内牌号 String[] BEF_STL_GRD = (String[])context.get("BEF_STL_GRD");//原厂内牌号 try { if(rowStatus != null) { int len = rowStatus.length; String infoProc= ""; String infoSql = ""; if("S".equals(INFO[0])) { // infoProc = "UIB020050_02.CALL_SLABNO";//板坯成分改判牌号后的判定 cstm = dao.getCallableStatement("UIB020050_02.CALL_SLABNO"); for(int i = 0; i < len; i++) { param = new PosParameter(); param.setWhereClauseParameter(0, STL_GRD[i]);//厂内牌号 param.setWhereClauseParameter(1, BEF_STL_GRD[i]);//原厂内牌号 param.setWhereClauseParameter(2, CHARGE_NO[i]);//板坯号 dao.update("UIB020050_03.UPDATE" , param); cstm.setString(1, CHARGE_NO[i]); cstm.setString(2, "2"); cstm.registerOutParameter(3, java.sql.Types.VARCHAR); cstm.registerOutParameter(4, java.sql.Types.VARCHAR); cstm.execute(); } } else { // infoProc = "UIB020050_01.CALL_CHARGENO";//炉次成分该判牌号后的判定 cstm = dao.getCallableStatement("UIB020050_01.CALL_CHARGENO"); for(int i = 0; i < len; i++) { param = new PosParameter(); param.setWhereClauseParameter(0, STL_GRD[i]);//厂内牌号 param.setWhereClauseParameter(1, BEF_STL_GRD[i]);//原厂内牌号 param.setWhereClauseParameter(2, CHARGE_NO[i]);//炉号 dao.update("UIB020050_01.UPDATE" , param); // add 0714 改判需要将余材 param = new PosParameter(); param.setWhereClauseParameter(0, STL_GRD[i]); param.setWhereClauseParameter(1, BEF_STL_GRD[i]); param.setWhereClauseParameter(2, CHARGE_NO[i]); dao.update("UIB020050_02.UPDATE" , param); //add 0714 改判需要将余材 param = new PosParameter(); param.setWhereClauseParameter(0, CHARGE_NO[i]); dao.update("UIB020050_03.UPDATE" , param); //add cstm.setString(1, CHARGE_NO[i]); cstm.registerOutParameter(2, java.sql.Types.VARCHAR); cstm.registerOutParameter(3, java.sql.Types.VARCHAR); cstm.execute(); } } } }catch(Exception ex) { logger.logError(ex.getMessage(), ex); }finally { if (cstm != null) { try { cstm.close(); } catch (SQLException e) { logger.logWarn(e.getMessage(), e); } } } return PosBizControlConstants.SUCCESS; } }