f59ab75f48918c5babbaca78618bbe25e8b9eec8.svn-base 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. package xin.glue.ui.F.F02;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.SQLException;
  5. import java.sql.Types;
  6. import com.posdata.glue.PosException;
  7. import com.posdata.glue.biz.activity.PosActivity;
  8. import com.posdata.glue.biz.constants.PosBizControlConstants;
  9. import com.posdata.glue.biz.control.PosBizProvider;
  10. import com.posdata.glue.context.PosContext;
  11. import com.posdata.glue.dao.vo.PosParameter;
  12. import com.posdata.glue.dao.vo.PosRow;
  13. import com.posdata.glue.dao.vo.PosRowSet;
  14. import com.posdata.glue.msg.PosMESMessageImpl;
  15. import com.posdata.glue.msg.PosMessage;
  16. public class CCRIndicationsave extends PosActivity
  17. {
  18. String P_TYPE = "";
  19. String P_ST = "";
  20. String P_EN = "";
  21. String P_RTN_MSG = "";
  22. public String runActivity(PosContext context)
  23. {
  24. CallableStatement cStmt = null;
  25. String[] P_REG_ID = (String[]) context.get("USER_NAME");
  26. cStmt = this.getDao("mesdao").getCallableStatement("callCCRIndicationSave");
  27. try {
  28. if(cStmt != null) {
  29. cStmt.setString(1,P_REG_ID[0]);
  30. cStmt.registerOutParameter(2, Types.VARCHAR);
  31. cStmt.registerOutParameter(3, Types.VARCHAR);
  32. cStmt.registerOutParameter(4, Types.VARCHAR);
  33. cStmt.registerOutParameter(5, Types.VARCHAR);
  34. cStmt.execute();
  35. P_TYPE = cStmt.getString(2);
  36. P_ST = cStmt.getString(3);
  37. P_EN = cStmt.getString(4);
  38. P_RTN_MSG = cStmt.getString(5);
  39. // NIF024050_CALL(P_TYPE,P_ST,P_EN);
  40. }
  41. } catch (SQLException e) {
  42. // e.printStackTrace();
  43. logger.logError(e.getMessage());
  44. context.put("errorMsg", e.getMessage());
  45. return PosBizControlConstants.FAILURE;
  46. //throw new PosException(e.getMessage());
  47. }finally
  48. {
  49. if (cStmt != null)
  50. {
  51. try
  52. {
  53. cStmt.close();
  54. }
  55. catch (SQLException e)
  56. {
  57. logger.logWarn(e.getMessage(), e);
  58. }
  59. }
  60. }
  61. if(P_RTN_MSG == null || "".equals(P_RTN_MSG)) {
  62. NIF024050_CALL(P_TYPE,P_ST,P_EN);
  63. } else {
  64. logger.logError(P_RTN_MSG);
  65. context.put("errorMsg", P_RTN_MSG);
  66. return PosBizControlConstants.FAILURE;
  67. //throw new PosException(P_RTN_MSG);
  68. }
  69. //SELECT CHARGE INFORMATION
  70. PosRowSet SlabInfVO = getDao("mesdao").find("NIF012140_SlabInf.select");
  71. SlabInfVO.reset();
  72. while(SlabInfVO.hasNext()) {
  73. PosRow SlabInfRow = SlabInfVO.next();
  74. String V_SLAB_NO = (String)SlabInfRow.getAttribute("SLAB_NO");
  75. long V_PREV_SLAB_WGT = Long.parseLong((SlabInfRow.getAttribute("SLAB_WGT")==null? "0":SlabInfRow.getAttribute("SLAB_WGT")).toString());
  76. String V_ORD_NO = (String)SlabInfRow.getAttribute("ORD_NO");
  77. String V_ORD_SEQ = (String)SlabInfRow.getAttribute("ORD_SEQ");
  78. //CALL NIE012070_SaveOrdSts
  79. NIE012070_CALL(V_SLAB_NO, V_PREV_SLAB_WGT,V_ORD_NO, V_ORD_SEQ,P_REG_ID[0]);
  80. } //SlabInfVO while END
  81. CallableStatement cStmt2 = null;
  82. try {
  83. cStmt2 = this.getDao("mesdao").getCallableStatement("callCCR_IndicationDealAfterCallNIE");
  84. cStmt2.registerOutParameter(1, Types.VARCHAR);
  85. if(cStmt2 != null) {
  86. cStmt2.execute();
  87. }
  88. // P_RTN_MSG = cStmt2.getString(1);
  89. // if( "OK".equals(sOutParam) ){
  90. // NIE012080_CALL();
  91. // } else {
  92. // logger.logError(sOutParam);
  93. // }
  94. } catch (SQLException e) {
  95. // e.printStackTrace();
  96. logger.logError(e.getMessage());
  97. context.put("errorMsg", e.getMessage());
  98. return PosBizControlConstants.FAILURE;
  99. //throw new PosException(e.getMessage());
  100. } finally {
  101. if (cStmt2 != null) {
  102. try {cStmt2.close();} catch (SQLException e){logger.logWarn(e.getMessage(), e);}
  103. }
  104. }
  105. if(P_RTN_MSG == null || "".equals(P_RTN_MSG)) {
  106. NIE012080_CALL();
  107. } else {
  108. logger.logError(P_RTN_MSG);
  109. context.put("errorMsg", P_RTN_MSG);
  110. return PosBizControlConstants.FAILURE;
  111. //throw new PosException();
  112. }
  113. return PosBizControlConstants.SUCCESS;
  114. }
  115. public PosContext NIE012070_CALL(String V_SLAB_NO, long V_WGT,String V_ORD_NO ,String V_ORD_SEQ,String V_REG_ID)
  116. {
  117. PosContext context = new PosContext();
  118. PosMessage message = new PosMESMessageImpl();
  119. //SaveOrdSts
  120. String TcId = "NIE012070";
  121. message.setTCID(TcId);
  122. message.setObject("MSG_ID", TcId);
  123. message.setObject("BEF_ORD_NO", "");
  124. message.setObject("BEF_ORD_SEQ", "");
  125. message.setObject("ORD_NO", V_ORD_NO );
  126. message.setObject("ORD_SEQ", V_ORD_SEQ);
  127. message.setObject("BEF_PROG_CD", "RBA");
  128. message.setObject("PROG_CD", "RBB");
  129. message.setObject("MAT_TYPE", "TM");
  130. message.setObject("MAT_NO", V_SLAB_NO);
  131. message.setObject("WGT", new BigDecimal(V_WGT));
  132. message.setObject("PGMID", "CCRIndicationsave");
  133. message.setObject("REG_ID", V_REG_ID);
  134. context.setMessage(message);
  135. message.setTCID(TcId);
  136. String SERVICE_POSTFIX = "-service";
  137. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  138. PosBizProvider.getController().doSubController(context, false);
  139. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  140. if (SERVICE_ERR_MSG != null)
  141. {
  142. throw new PosException(SERVICE_ERR_MSG);
  143. }
  144. return context;
  145. }
  146. public PosContext NIE012080_CALL()
  147. {
  148. PosContext context = new PosContext();
  149. PosMessage message = new PosMESMessageImpl();
  150. //OrdStsMain
  151. String TcId = "NIE012080";
  152. message.setTCID(TcId);
  153. message.setObject("MSG_ID", TcId);
  154. message.setObject("AA", "");
  155. context.setMessage(message);
  156. message.setTCID(TcId);
  157. String SERVICE_POSTFIX = "-service";
  158. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  159. PosBizProvider.getController().doSubController(context, false);
  160. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  161. if (SERVICE_ERR_MSG != null)
  162. {
  163. throw new PosException(SERVICE_ERR_MSG);
  164. }
  165. return context;
  166. }
  167. public PosContext NIF024050_CALL(String V_TYPE, String V_ST,String V_EN)
  168. {
  169. PosContext context = new PosContext();
  170. PosMessage message = new PosMESMessageImpl();
  171. String TcId = "NIF024050";
  172. message.setTCID(TcId);
  173. message.setObject("TYPE", V_TYPE);
  174. message.setObject("FROM", V_ST);
  175. message.setObject("TO", V_EN);
  176. context.setMessage(message);
  177. message.setTCID(TcId);
  178. String SERVICE_POSTFIX = "-service";
  179. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  180. PosBizProvider.getController().doSubController(context, false);
  181. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  182. if (SERVICE_ERR_MSG != null)
  183. {
  184. throw new PosException(SERVICE_ERR_MSG);
  185. }
  186. return context;
  187. }
  188. }