package xin.glue.ui.G.G04; import java.sql.CallableStatement; import java.sql.SQLException; import org.apache.commons.lang.StringUtils; 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; public class SaveL2Wgt_new extends PosActivity{ public String runActivity(PosContext context) { PosGenericDao dao = this.getDao("mesdao"); CallableStatement cstm= null; String[] SlabNo = (String[])context.get("SLAB_NO"); String[] User = (String[])context.get("USER"); String[] weightWgt = (String[])context.get("WEIGHT_WGT"); String[] samplingid = (String[])context.get("SAMPLINGID"); String[] CHK = (String[])context.get("CHK"); String[] type = (String[])context.get("TYPE"); String[] upwgt= (String[])context.get("WIGHT_UPDATE"); String[] CHK2 = (String[])context.get("CHK2"); String[] remark = (String[])context.get("REMARK"); if(SlabNo.length == 0){ return PosBizControlConstants.SUCCESS; } StringBuffer slabNOs = new StringBuffer(); for(int i = 0 ; i < SlabNo.length;i++){ if(!CHK[i].equals("Y"))continue; try { cstm = dao.getCallableStatement("UIG050021_01.call"); cstm.setString(1, SlabNo[i]); cstm.setString(2, weightWgt[i]); cstm.setString(3, samplingid[i]); cstm.setString(4, User[0]); cstm.setString(5, type[0]); cstm.setString(6, upwgt[i]); cstm.setString(7, CHK2[i]); cstm.setString(8, remark[i]); cstm.registerOutParameter(9, java.sql.Types.VARCHAR); cstm.execute(); if(!StringUtils.isBlank(cstm.getString(9))){ context.put("MESSAGES", cstm.getString(9)); }else{ context.put("MESSAGES", "²Ù×÷³É¹¦!"); } } catch(Exception ex) { logger.logDebug(ex.getMessage()); return PosBizControlConstants.SUCCESS; }finally { if (cstm != null) { try { cstm.close(); } catch (SQLException e) { logger.logWarn(e.getMessage(), e); } } } } return PosBizControlConstants.SUCCESS; } }