package xin.glue.ui.F.F02; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.SQLException; import java.sql.Types; import com.posdata.glue.PosException; import com.posdata.glue.biz.activity.PosActivity; import com.posdata.glue.biz.constants.PosBizControlConstants; import com.posdata.glue.biz.control.PosBizProvider; import com.posdata.glue.context.PosContext; import com.posdata.glue.dao.vo.PosParameter; import com.posdata.glue.dao.vo.PosRow; import com.posdata.glue.dao.vo.PosRowSet; import com.posdata.glue.msg.PosMESMessageImpl; import com.posdata.glue.msg.PosMessage; public class CCRIndicationsave extends PosActivity { String P_TYPE = ""; String P_ST = ""; String P_EN = ""; String P_RTN_MSG = ""; public String runActivity(PosContext context) { CallableStatement cStmt = null; String[] P_REG_ID = (String[]) context.get("USER_NAME"); cStmt = this.getDao("mesdao").getCallableStatement("callCCRIndicationSave"); try { if(cStmt != null) { cStmt.setString(1,P_REG_ID[0]); cStmt.registerOutParameter(2, Types.VARCHAR); cStmt.registerOutParameter(3, Types.VARCHAR); cStmt.registerOutParameter(4, Types.VARCHAR); cStmt.registerOutParameter(5, Types.VARCHAR); cStmt.execute(); P_TYPE = cStmt.getString(2); P_ST = cStmt.getString(3); P_EN = cStmt.getString(4); P_RTN_MSG = cStmt.getString(5); // NIF024050_CALL(P_TYPE,P_ST,P_EN); } } catch (SQLException e) { // e.printStackTrace(); logger.logError(e.getMessage()); context.put("errorMsg", e.getMessage()); return PosBizControlConstants.FAILURE; //throw new PosException(e.getMessage()); }finally { if (cStmt != null) { try { cStmt.close(); } catch (SQLException e) { logger.logWarn(e.getMessage(), e); } } } if(P_RTN_MSG == null || "".equals(P_RTN_MSG)) { NIF024050_CALL(P_TYPE,P_ST,P_EN); } else { logger.logError(P_RTN_MSG); context.put("errorMsg", P_RTN_MSG); return PosBizControlConstants.FAILURE; //throw new PosException(P_RTN_MSG); } //SELECT CHARGE INFORMATION PosRowSet SlabInfVO = getDao("mesdao").find("NIF012140_SlabInf.select"); SlabInfVO.reset(); while(SlabInfVO.hasNext()) { PosRow SlabInfRow = SlabInfVO.next(); String V_SLAB_NO = (String)SlabInfRow.getAttribute("SLAB_NO"); long V_PREV_SLAB_WGT = Long.parseLong((SlabInfRow.getAttribute("SLAB_WGT")==null? "0":SlabInfRow.getAttribute("SLAB_WGT")).toString()); String V_ORD_NO = (String)SlabInfRow.getAttribute("ORD_NO"); String V_ORD_SEQ = (String)SlabInfRow.getAttribute("ORD_SEQ"); //CALL NIE012070_SaveOrdSts NIE012070_CALL(V_SLAB_NO, V_PREV_SLAB_WGT,V_ORD_NO, V_ORD_SEQ,P_REG_ID[0]); } //SlabInfVO while END CallableStatement cStmt2 = null; try { cStmt2 = this.getDao("mesdao").getCallableStatement("callCCR_IndicationDealAfterCallNIE"); cStmt2.registerOutParameter(1, Types.VARCHAR); if(cStmt2 != null) { cStmt2.execute(); } // P_RTN_MSG = cStmt2.getString(1); // if( "OK".equals(sOutParam) ){ // NIE012080_CALL(); // } else { // logger.logError(sOutParam); // } } catch (SQLException e) { // e.printStackTrace(); logger.logError(e.getMessage()); context.put("errorMsg", e.getMessage()); return PosBizControlConstants.FAILURE; //throw new PosException(e.getMessage()); } finally { if (cStmt2 != null) { try {cStmt2.close();} catch (SQLException e){logger.logWarn(e.getMessage(), e);} } } if(P_RTN_MSG == null || "".equals(P_RTN_MSG)) { NIE012080_CALL(); } else { logger.logError(P_RTN_MSG); context.put("errorMsg", P_RTN_MSG); return PosBizControlConstants.FAILURE; //throw new PosException(); } return PosBizControlConstants.SUCCESS; } public PosContext NIE012070_CALL(String V_SLAB_NO, long V_WGT,String V_ORD_NO ,String V_ORD_SEQ,String V_REG_ID) { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); //SaveOrdSts String TcId = "NIE012070"; message.setTCID(TcId); message.setObject("MSG_ID", TcId); message.setObject("BEF_ORD_NO", ""); message.setObject("BEF_ORD_SEQ", ""); message.setObject("ORD_NO", V_ORD_NO ); message.setObject("ORD_SEQ", V_ORD_SEQ); message.setObject("BEF_PROG_CD", "RBA"); message.setObject("PROG_CD", "RBB"); message.setObject("MAT_TYPE", "TM"); message.setObject("MAT_NO", V_SLAB_NO); message.setObject("WGT", new BigDecimal(V_WGT)); message.setObject("PGMID", "CCRIndicationsave"); message.setObject("REG_ID", V_REG_ID); context.setMessage(message); message.setTCID(TcId); String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX); PosBizProvider.getController().doSubController(context, false); String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG"); if (SERVICE_ERR_MSG != null) { throw new PosException(SERVICE_ERR_MSG); } return context; } public PosContext NIE012080_CALL() { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); //OrdStsMain String TcId = "NIE012080"; message.setTCID(TcId); message.setObject("MSG_ID", TcId); message.setObject("AA", ""); context.setMessage(message); message.setTCID(TcId); String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX); PosBizProvider.getController().doSubController(context, false); String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG"); if (SERVICE_ERR_MSG != null) { throw new PosException(SERVICE_ERR_MSG); } return context; } public PosContext NIF024050_CALL(String V_TYPE, String V_ST,String V_EN) { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); String TcId = "NIF024050"; message.setTCID(TcId); message.setObject("TYPE", V_TYPE); message.setObject("FROM", V_ST); message.setObject("TO", V_EN); context.setMessage(message); message.setTCID(TcId); String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX); PosBizProvider.getController().doSubController(context, false); String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG"); if (SERVICE_ERR_MSG != null) { throw new PosException(SERVICE_ERR_MSG); } return context; } }