128f96a6ac9e397f6b9158b3e2d8afc40ce7f619.svn-base 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  1. package xin.glue.nui.F.F01;
  2. import java.math.BigDecimal;
  3. import xin.glue.user.common.GlobalConstants;
  4. import xin.glue.user.common.LogGpError;
  5. import com.posdata.glue.PosException;
  6. import com.posdata.glue.biz.activity.PosActivity;
  7. import com.posdata.glue.biz.constants.PosBizControlConstants;
  8. import com.posdata.glue.biz.control.PosBizProvider;
  9. import com.posdata.glue.context.PosContext;
  10. import com.posdata.glue.dao.vo.PosParameter;
  11. import com.posdata.glue.dao.vo.PosRow;
  12. import com.posdata.glue.dao.vo.PosRowSet;
  13. import com.posdata.glue.msg.PosMESMessageImpl;
  14. import com.posdata.glue.msg.PosMessage;
  15. /* Program Name SMSLvlCancel (NIF012140)
  16. * Description SMS WORK INSTRUCTION LEVEL2 CANCEL CHARGE PLAN
  17. * Write By KIM SUNG HO
  18. * Date 2008-11-05
  19. */
  20. public class SMSLvlCan extends PosActivity implements GlobalConstants {
  21. public String runActivity(PosContext context) {
  22. long V_CHARGE_EDT_SEQ = 0 ;
  23. long V_STS_CNT = 0 ;
  24. long V_CHG_SEQ = 0 ;
  25. long V_PREV_CHARGE_WGT = 0 ;
  26. String V_CHARGE_MANA_NO = "" ;
  27. String V_TABLE_ID = "";
  28. String V_TABLE_MODE = "";
  29. String V_ERR_DESC = "";
  30. String V_RTN_NAME = "";
  31. PosMessage message = context.getMessage();
  32. String P_CHARGE_MANA_NO_ST = (String)message.get("CHARGE_MANA_NO_ST");
  33. String P_REG_ID = (String)message.get("REG_ID");
  34. //String PRC_LINE_ST = P_CHARGE_MANA_NO_ST.substring(3, 4);
  35. String PRC_LINE_ST = P_CHARGE_MANA_NO_ST.substring(2, 3);
  36. //P_CHARGE_MANA_NO_EN IS NULL CHECK
  37. if (P_CHARGE_MANA_NO_ST == null || P_CHARGE_MANA_NO_ST.equals("") ) {
  38. //MESSAGE ERROR --> PROGRAM EXIT
  39. //throw new PosException("SMSLvlCancel..CHARGE_MANA_NO_ST IS NULL");
  40. logger.logInfo("SMSLvlCancel..CHARGE_MANA_NO_ST IS NULL");
  41. context.put("errorMsg", "SMSLvlCancel..CHARGE_MANA_NO_ST IS NULL");
  42. return PosBizControlConstants.FAILURE;
  43. }
  44. //SELECT CHG_SEQ
  45. PosParameter paramA = new PosParameter();
  46. paramA.setWhereClauseParameter(0, PRC_LINE_ST);
  47. paramA.setWhereClauseParameter(1, P_CHARGE_MANA_NO_ST);
  48. PosRowSet ChgSeqInfVO = getDao("mesdao").find("NIF012140_ChgSeqInf.select",paramA);
  49. ChgSeqInfVO.reset();
  50. if (ChgSeqInfVO.hasNext()) {
  51. PosRow ChgSeqInfRow = ChgSeqInfVO.next();
  52. V_CHG_SEQ = Long.parseLong((ChgSeqInfRow.getAttribute("CHG_SEQ")==null? "0":ChgSeqInfRow.getAttribute("CHG_SEQ")).toString());
  53. } else {
  54. //MESSAGE ERROR --> PROGRAM EXIT
  55. throw new PosException("SMSLvlCancel..Not Found ChgSeqInf");
  56. }
  57. //SELECT COUNT(STATUS_CD <> "A")
  58. PosParameter param0 = new PosParameter();
  59. param0.setWhereClauseParameter(0, PRC_LINE_ST);
  60. param0.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
  61. PosRowSet ChgCntChkVO = getDao("mesdao").find("NIF012140_ChgCntChk.select",param0);
  62. ChgCntChkVO.reset();
  63. if (ChgCntChkVO.hasNext()) {
  64. PosRow ChgCntChkRow = ChgCntChkVO.next();
  65. V_STS_CNT = Long.parseLong((ChgCntChkRow.getAttribute("STATUS_CNT")==null? "0":ChgCntChkRow.getAttribute("STATUS_CNT")).toString());
  66. if (V_STS_CNT != 0) {
  67. //MESSAGE ERROR --> PROGRAM EXIT
  68. throw new PosException("SMSLvlCancel..Not Found ChgCntChk");
  69. }
  70. }
  71. PosParameter param2 = new PosParameter();
  72. param2.setValueParamter(0, PRC_LINE_ST);
  73. param2.setValueParamter(1, String.valueOf(V_CHG_SEQ));
  74. int InsCnt1 = getDao("mesdao").insert("NIF012140_L2Charge.insert",param2);
  75. if (InsCnt1 == 0) {
  76. V_TABLE_ID = "TBG06_L2_CHARGE_INS";
  77. V_TABLE_MODE = "I";
  78. V_ERR_DESC = "TBG06_L2_CHARGE_INS INSERT COUNT IS ZERO";
  79. V_RTN_NAME = "SMSLvlCancel TBG06_L2_CHARGE_INS INSERT1 " + String.valueOf(V_CHARGE_EDT_SEQ);
  80. LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
  81. throw new PosException(V_RTN_NAME);
  82. }
  83. PosParameter param3 = new PosParameter();
  84. param3.setValueParamter(0, PRC_LINE_ST);
  85. param3.setValueParamter(1, String.valueOf(V_CHG_SEQ));
  86. int InsCnt2 = getDao("mesdao").insert("NIF012140_L2Ccm.insert",param3);
  87. if (InsCnt2 == 0) {
  88. V_TABLE_ID = "TBG06_L2_CCM_INS";
  89. V_TABLE_MODE = "I";
  90. V_ERR_DESC = "TBG06_L2_CCM_INS INSERT COUNT IS ZERO";
  91. V_RTN_NAME = "SMSLvlCancel TBG06_L2_CCM_INS INSERT2 " + String.valueOf(V_CHARGE_EDT_SEQ);
  92. LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
  93. throw new PosException(V_RTN_NAME);
  94. }
  95. PosParameter param4 = new PosParameter();
  96. param4.setValueParamter(0, PRC_LINE_ST);
  97. param4.setValueParamter(1, String.valueOf(V_CHG_SEQ));
  98. int InsCnt3 = getDao("mesdao").insert("NIF012140_L2SlabCut.insert",param4);
  99. if (InsCnt3 == 0) {
  100. V_TABLE_ID = "TBG06_L2_SLAB_CUT_INS";
  101. V_TABLE_MODE = "I";
  102. V_ERR_DESC = "TBG06_L2_SLAB_CUT_INS INSERT COUNT IS ZERO";
  103. V_RTN_NAME = "SMSLvlCancel TBG06_L2_SLAB_CUT_INS INSERT3 " + String.valueOf(V_CHARGE_EDT_SEQ);
  104. LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
  105. throw new PosException(V_RTN_NAME);
  106. }
  107. //UPDATE TBF01_SPEC_CHARGE (PROG_CD="JBA")
  108. PosParameter param5 = new PosParameter();
  109. param5.setWhereClauseParameter(0, PRC_LINE_ST);
  110. param5.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
  111. int UptCnt1 = getDao("mesdao").update("NIF012140_ChargeProgUpd.update",param5);
  112. if (UptCnt1 == 0) {
  113. V_TABLE_ID = "TBF01_SPEC_CHARGE";
  114. V_TABLE_MODE = "U";
  115. V_ERR_DESC = "TBF01_SPEC_CHARGE UPDATE COUNT IS ZERO";
  116. V_RTN_NAME = "SMSLvlCancel TBF01_SPEC_CHARGE UPDATE1 " + String.valueOf(V_CHARGE_EDT_SEQ);
  117. LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
  118. throw new PosException(V_RTN_NAME);
  119. }
  120. //SELECT CHARGE INFORMATION
  121. PosParameter param1 = new PosParameter();
  122. param1.setWhereClauseParameter(0, PRC_LINE_ST);
  123. param1.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
  124. PosRowSet ChargeInfVO = getDao("mesdao").find("NIF012140_ChargeInf.select",param0);
  125. ChargeInfVO.reset();
  126. while(ChargeInfVO.hasNext()) {
  127. PosRow ChargeInfRow = ChargeInfVO.next();
  128. V_CHARGE_EDT_SEQ = Long.parseLong((ChargeInfRow.getAttribute("CHARGE_EDT_SEQ")==null? "0":ChargeInfRow.getAttribute("CHARGE_EDT_SEQ")).toString());
  129. V_CHARGE_MANA_NO = (String)ChargeInfRow.getAttribute("CHARGE_MANA_NO");
  130. V_PREV_CHARGE_WGT = Long.parseLong((ChargeInfRow.getAttribute("PREV_CHARGE_WGT")==null? "0":ChargeInfRow.getAttribute("PREV_CHARGE_WGT")).toString());
  131. //CALL NIE012070_SaveOrdSts
  132. NIE012070_CALL(V_CHARGE_MANA_NO, V_PREV_CHARGE_WGT, P_REG_ID);
  133. } //ChargeInfVO while END
  134. //UPDATE TBF01_CHARGE_IDX (LEVEL2 CANCEL MARKING)
  135. PosParameter param6 = new PosParameter();
  136. param6.setWhereClauseParameter(0, PRC_LINE_ST);
  137. param6.setWhereClauseParameter(1, String.valueOf(V_CHG_SEQ));
  138. int UptCnt2 = getDao("mesdao").update("NIF012140_ChargeIdxUpd.update",param6);
  139. if (UptCnt2 == 0) {
  140. V_TABLE_ID = "TBF01_CHARGE_IDX";
  141. V_TABLE_MODE = "U";
  142. V_ERR_DESC = "TBF01_CHARGE_IDX UPDATE COUNT IS ZERO";
  143. V_RTN_NAME = "SMSLvlCancel TBF01_CHARGE_IDX UPDATE2 " + String.valueOf(V_CHARGE_EDT_SEQ);
  144. LogGpError.logMessageToDB("SMSLvlCancel", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
  145. throw new PosException(V_RTN_NAME);
  146. }
  147. //------------------------------------------------------------------------------------------------
  148. //CALL NIE012080_OrdStsMain
  149. NIE012080_CALL();
  150. //------------------------------------------------------------------------------------------------
  151. //LEVEL2 JOB SCHEDULE CALL
  152. return PosBizControlConstants.SUCCESS;
  153. }
  154. public PosContext NIE012070_CALL(String V_CHARGE_MANA_NO, long V_WGT, String V_REG_ID)
  155. {
  156. PosContext context = new PosContext();
  157. PosMessage message = new PosMESMessageImpl();
  158. //SaveOrdSts
  159. String TcId = "NIE012070";
  160. message.setTCID(TcId);
  161. message.setObject("MSG_ID", TcId);
  162. message.setObject("BEF_ORD_NO", "");
  163. message.setObject("BEF_ORD_SEQ", "");
  164. message.setObject("ORD_NO", "");
  165. message.setObject("ORD_SEQ", "");
  166. message.setObject("BEF_PROG_CD", "JBB");
  167. message.setObject("PROG_CD", "JBA");
  168. message.setObject("MAT_TYPE", "CH");
  169. message.setObject("MAT_NO", V_CHARGE_MANA_NO);
  170. message.setObject("WGT", new BigDecimal(V_WGT));
  171. message.setObject("PGMID", "SMSLvlCan");
  172. message.setObject("REG_ID", V_REG_ID);
  173. context.setMessage(message);
  174. message.setTCID(TcId);
  175. String SERVICE_POSTFIX = "-service";
  176. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  177. PosBizProvider.getController().doSubController(context, false);
  178. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  179. if (SERVICE_ERR_MSG != null)
  180. {
  181. throw new PosException(SERVICE_ERR_MSG);
  182. }
  183. return context;
  184. }
  185. public PosContext NIE012080_CALL()
  186. {
  187. PosContext context = new PosContext();
  188. PosMessage message = new PosMESMessageImpl();
  189. //OrdStsMain
  190. String TcId = "NIE012080";
  191. message.setTCID(TcId);
  192. message.setObject("MSG_ID", TcId);
  193. message.setObject("AA", "");
  194. context.setMessage(message);
  195. message.setTCID(TcId);
  196. String SERVICE_POSTFIX = "-service";
  197. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  198. PosBizProvider.getController().doSubController(context, false);
  199. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  200. if (SERVICE_ERR_MSG != null)
  201. {
  202. throw new PosException(SERVICE_ERR_MSG);
  203. }
  204. return context;
  205. }
  206. }