PcontSignDriver.java 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /**
  2. * @(#)file BidPlanSignDriver.java
  3. * @(#)author Son hyungmin
  4. * @(#)version 1.0
  5. * @(#)date 2014-09-29
  6. * @(#)since JDK 1.4.2
  7. *
  8. * Copyright (c) www.dcchem.co.kr, Inc.
  9. * All rights reserved.
  10. * This software is the proprietary information of dcchem, Inc.
  11. */
  12. package kr.co.udapsoft.common.commonSign.driver;
  13. import java.sql.Connection;
  14. import kr.co.hsnc.common.base.WAFLogger;
  15. import kr.co.hsnc.common.sql.persistent.Persistent;
  16. import kr.co.hsnc.common.sql.persistent.PersistentImpl;
  17. import kr.co.hsnc.common.util.ValueObject;
  18. import kr.co.udapsoft.common.commonSign.CommonSignInterface;
  19. import oracle.toplink.internal.ox.StrBuffer;
  20. /**
  21. *
  22. * @version 1.0
  23. * @author Beomgeun Lee
  24. */
  25. public class PcontSignDriver implements CommonSignInterface {
  26. /**
  27. * 테슽 파일
  28. *
  29. */
  30. public PcontSignDriver() {
  31. super();
  32. }
  33. /*
  34. * (non-Javadoc)
  35. * @see kr.co.udap.ehr.common.sign.SignInterface#doCallSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  36. */
  37. public void doCallSign(Connection connection, ValueObject signDoc) throws Exception {
  38. System.out.println("!!doCallSign");
  39. }
  40. /*
  41. * (non-Javadoc)
  42. * @see kr.co.udap.ehr.common.sign.SignInterface#doStartSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  43. */
  44. public void doStartSign(Connection connection, ValueObject signDoc) throws Exception {
  45. System.out.println("!!doStartSign");
  46. }
  47. /*
  48. * (non-Javadoc)
  49. * @see kr.co.udap.ehr.common.sign.SignInterface#doFirstFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  50. */
  51. public void doFirstFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  52. System.out.println("!!doFirstFinishSign");
  53. System.out.println("### 결재 Strart");
  54. updateMaster(connection, signDoc);
  55. addBcsCont(connection, signDoc);//2017.2.7 변경시행결의후 예산등록
  56. System.out.println("### 결재 End");
  57. }
  58. /*
  59. * (non-Javadoc)
  60. * @see kr.co.udap.ehr.common.sign.SignInterface#doFinishSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  61. */
  62. public void doFinishSign(Connection connection, ValueObject signDoc) throws Exception {
  63. System.out.println("!!doFinishSign");
  64. }
  65. /*
  66. * (non-Javadoc)
  67. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  68. */
  69. public void doFirstRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  70. System.out.println("!!반려");
  71. updateMaster(connection, signDoc);
  72. }
  73. /*
  74. * (non-Javadoc)
  75. * @see kr.co.udap.ehr.common.sign.SignInterface#doRejectSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  76. */
  77. public void doRejectSign(Connection connection, ValueObject signDoc) throws Exception {
  78. System.out.println("!!doRejectSign");
  79. }
  80. /*
  81. * (non-Javadoc)
  82. * @see kr.co.udap.ehr.common.sign.SignInterface#doCancelSign(java.sql.Connection, com.udapsoft.common.util.ValueObject)
  83. */
  84. public void doCancelSign(Connection connection, ValueObject signDoc) throws Exception {
  85. System.out.println("!!doCancelSign");
  86. }
  87. /**
  88. * SAC01001 상태값을 업데이트해준다.
  89. * @param connection
  90. * @param valueObject
  91. * @throws Exception
  92. */
  93. public void updateMaster(Connection connection, ValueObject vo) throws Exception {
  94. Persistent persistent = new PersistentImpl(connection);
  95. StringBuffer sqlstr = null;
  96. try {
  97. sqlstr = new StringBuffer();
  98. String status = "";
  99. if(vo.get("SIGN_TYPE").equals("1")){
  100. if(vo.get("SIGN_DECI_CLASS").equals("14")){
  101. status = "02";//결재완료18->02 2016.03.16
  102. }else {
  103. status = "03";//반려 41->03
  104. }
  105. }
  106. sqlstr.append(" UPDATE PUR2000T \n");
  107. sqlstr.append(" SET STATUS_CD = ? \n");
  108. sqlstr.append(" WHERE PUR_CONT_MOD_ID = ? \n");
  109. persistent.setStatement(sqlstr.toString());
  110. persistent.addParameter(status);
  111. persistent.addParameter(vo.get("KEY_COL1"));
  112. persistent.execute();
  113. }
  114. catch(Exception e) {
  115. WAFLogger.error(this.getClass().getName() + " --> updateSac01001() : " + e.getMessage());
  116. WAFLogger.error("SQL : " + sqlstr);
  117. WAFLogger.error(e);
  118. throw e;
  119. }
  120. }
  121. //2017.2.7 변경시행결의후 예산등록
  122. public boolean addBcsCont(Connection connection, ValueObject vo) throws Exception {
  123. //WAFLogger.debug("valueObject : " + valueObject);
  124. Persistent persistent = new PersistentImpl(connection);
  125. StrBuffer sqlstr = new StrBuffer();
  126. try {
  127. sqlstr.append("INSERT INTO BCS_MR \n");
  128. sqlstr.append(" ( DEPT_CD \n");
  129. sqlstr.append(" ,MR_ID \n");
  130. sqlstr.append(" ,KIND_GB \n");
  131. sqlstr.append(" ,MR_NO \n");
  132. sqlstr.append(" ,TITLE \n");
  133. sqlstr.append(" ,CONAMT \n");
  134. sqlstr.append(" ,CONDATE \n");
  135. sqlstr.append(" ,CONT_ID \n");
  136. sqlstr.append(" ,CONT_MOD_ID \n");
  137. sqlstr.append(" ,VENDOR_NM \n");
  138. sqlstr.append(" ,CRE_DATE \n");
  139. sqlstr.append(" ,CRE_BY \n");
  140. sqlstr.append(" ,CURRENCY_GB ) \n");
  141. sqlstr.append(" SELECT A.DEPT_CD \n");//DEPT_CD
  142. sqlstr.append(" , (SELECT DECODE(COUNT(*), 0, 1, MAX(MR_ID)+1) FROM BCS_MR WHERE DEPT_CD = A.DEPT_CD ) \n");//MR_ID
  143. sqlstr.append(" , 'P' \n");//DEMANDED_KIND
  144. sqlstr.append(" , SUBSTR(A.REQ_DOC_NO, 11, LENGTH(A.REQ_DOC_NO)-10) \n");//MR_NO
  145. sqlstr.append(" , A.CST_DOC_NAME \n");//TITLE
  146. sqlstr.append(" , A.ORD_SUPPLY_AMT \n");//CONAMT
  147. sqlstr.append(" , SYSDATE \n");//CONDATE
  148. sqlstr.append(" , A.PUR_CONT_ID \n");//CONT_ID
  149. sqlstr.append(" , A.PUR_CONT_MOD_ID \n");//CONT_MOD_ID
  150. sqlstr.append(" , B.MEMBER_NAME \n");//VENDOR_NM
  151. sqlstr.append(" , SYSDATE \n");//CRE_DATE
  152. sqlstr.append(" , 999 \n");//CRE_BY
  153. sqlstr.append(" , A.CURRENCY_GB \n");//CURRENCY_GB
  154. sqlstr.append(" FROM PUR2000T A \n");
  155. sqlstr.append(" , CONT_PUR_SUPP B \n");
  156. sqlstr.append(" WHERE A.PUR_CONT_MOD_ID = B.PUR_CONT_MOD_ID \n");
  157. sqlstr.append(" AND B.SIGN_SEQ = 2 \n");
  158. sqlstr.append(" AND A.PUR_CONT_MOD_ID= ? \n");
  159. persistent.setStatement(sqlstr.toString());
  160. persistent.addParameter(vo.get("KEY_COL1"));
  161. persistent.execute();
  162. return true;
  163. }
  164. catch(Exception e) {
  165. WAFLogger.error(this.getClass().getName() + " --> updUser() : " + e.getMessage());
  166. WAFLogger.error("SQL : " + sqlstr);
  167. WAFLogger.error(e);
  168. //WAFLogger.debug("Exception : " + e.getMessage());
  169. throw e;
  170. }
  171. }
  172. }