0e4326703efa926fde2ceab8942dcfa08bb59a16.svn-base 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. package xin.glue.nui.E.E01;
  2. import xin.glue.user.common.GlobalConstants;
  3. import com.posdata.glue.PosException;
  4. import com.posdata.glue.biz.activity.PosActivity;
  5. import com.posdata.glue.biz.constants.PosBizControlConstants;
  6. import com.posdata.glue.biz.control.PosBizProvider;
  7. import com.posdata.glue.context.PosContext;
  8. import com.posdata.glue.dao.vo.PosParameter;
  9. import com.posdata.glue.dao.vo.PosRow;
  10. import com.posdata.glue.dao.vo.PosRowSet;
  11. import com.posdata.glue.msg.PosMessage;
  12. import xin.glue.user.common.LogGpError;
  13. /* Program Name SaveOrdSts (NIE012070)
  14. * Description ORDER STATUS EVENT LOGGING
  15. * Write By KIM SUNG HO
  16. * Date 2008-10-13
  17. */
  18. public class SaveOrdSts extends PosActivity implements GlobalConstants {
  19. public String runActivity(PosContext context) {
  20. String V_TABLE_ID = "" ;
  21. String V_TABLE_MODE = "" ;
  22. String V_ERR_DESC = "" ;
  23. String V_RTN_NAME = "" ;
  24. PosMessage message = context.getMessage();
  25. String P_BEF_ORD_NO = (String)message.get("BEF_ORD_NO");
  26. String P_BEF_ORD_SEQ = (String)message.get("BEF_ORD_SEQ");
  27. String P_ORD_NO = (String)message.get("ORD_NO");
  28. String P_ORD_SEQ = (String)message.get("ORD_SEQ");
  29. String P_BEF_PROG_CD = (String)message.get("BEF_PROG_CD");
  30. String P_PROG_CD = (String)message.get("PROG_CD");
  31. String P_MAT_TYPE = (String)message.get("MAT_TYPE");
  32. String P_MAT_NO = (String)message.get("MAT_NO");
  33. Number P_WGT = (Number)message.get("WGT");
  34. String P_PGMID = (String)message.get("PGMID");
  35. String P_REG_ID = (String)message.get("REG_ID");
  36. try {
  37. if (P_MAT_TYPE == null || "".equals(P_MAT_TYPE)) {
  38. V_RTN_NAME = "SaveOrdSts MAT_TYPE IS NULL ";
  39. throw new PosException(V_RTN_NAME);
  40. }
  41. if (P_MAT_NO == null || "".equals(P_MAT_NO)) {
  42. V_RTN_NAME = "SaveOrdSts MAT_NO IS NULL ";
  43. throw new PosException(V_RTN_NAME);
  44. }
  45. PosParameter param0 = new PosParameter();
  46. PosRowSet rowset = null;
  47. PosRow row = null;
  48. if (P_MAT_TYPE.equals("CH")) {
  49. param0 = new PosParameter();
  50. param0.setWhereClauseParameter(0, P_MAT_NO);
  51. rowset = getDao("mesdao").find("NIE012070_SLAB_RT_CHECK.select", param0);
  52. while(rowset.hasNext()){
  53. row = rowset.next();
  54. String slabRt = (String)row.getAttribute("SLAB_RT");
  55. if(slabRt.equals("Z") || slabRt.equals("P")){
  56. return PosBizControlConstants.SUCCESS;
  57. }else{
  58. continue;
  59. }
  60. }
  61. } else if (P_MAT_TYPE.equals("TM")) {
  62. param0 = new PosParameter();
  63. param0.setWhereClauseParameter(0, P_MAT_NO);
  64. rowset = getDao("mesdao").find("NIE012070_SLAB_RT_CHECK02.select", param0);
  65. while(rowset.hasNext()){
  66. row = rowset.next();
  67. String slabRt = (String)row.getAttribute("SLAB_RT");
  68. if(slabRt.equals("Z") || slabRt.equals("P")){
  69. return PosBizControlConstants.SUCCESS;
  70. }else{
  71. continue;
  72. }
  73. }
  74. }
  75. //SELECT NXET SEQUEANCE FROM TBE02_ORDSTS
  76. String nextSeqQr = "SELECT ORDER_STATUS_OCC_SEQ.NEXTVAL NEXT_SEQ FROM DUAL ";
  77. PosRowSet nextSeqVO = getDao("mesdao").findByQueryStatement(nextSeqQr);
  78. nextSeqVO.reset();
  79. PosRow nextSeqRow = nextSeqVO.next();
  80. Number V_OCC_SEQ = (Number)nextSeqRow.getAttribute("NEXT_SEQ");
  81. param0 = new PosParameter();
  82. //SELECT PK CHECK FROM TBE02_ORDSTS
  83. String nextSeqChQr = "SELECT OCC_SEQ FROM TBE02_ORDSTS WHERE OCC_SEQ = ? ";
  84. param0.setWhereClauseParameter(0, V_OCC_SEQ);
  85. PosRowSet nextSeqChVO = getDao("mesdao").findByQueryStatement(nextSeqChQr, param0);
  86. if (nextSeqChVO.hasNext()) {
  87. PosParameter param1 = new PosParameter();
  88. param1.setValueParamter(0 , P_BEF_ORD_NO);
  89. param1.setValueParamter(1 , P_BEF_ORD_SEQ);
  90. param1.setValueParamter(2 , P_ORD_NO);
  91. param1.setValueParamter(3 , P_ORD_SEQ);
  92. param1.setValueParamter(4 , P_BEF_PROG_CD);
  93. param1.setValueParamter(5 , P_PROG_CD);
  94. param1.setValueParamter(6 , P_MAT_TYPE);
  95. param1.setValueParamter(7 , P_MAT_NO);
  96. param1.setValueParamter(8 , P_WGT);
  97. param1.setValueParamter(9 , P_PGMID);
  98. param1.setValueParamter(10, P_REG_ID);
  99. param1.setValueParamter(11, V_OCC_SEQ);
  100. int UpdCnt = getDao("mesdao").update("NIE012070_ORDSTS.update",param1);
  101. if (UpdCnt == 0) {
  102. V_TABLE_ID = "TBE02_ORDSTS";
  103. V_TABLE_MODE = "U";
  104. V_ERR_DESC = "TBE02_ORDSTS UPDATE COUNT IS ZERO";
  105. V_RTN_NAME = "SaveOrdSts TBE02_ORDSTS UPDATE " + V_OCC_SEQ;
  106. LogGpError.logMessageToDB("SaveOrdSts", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
  107. throw new PosException(V_RTN_NAME);
  108. }
  109. } else {
  110. PosParameter param2 = new PosParameter();
  111. param2.setValueParamter(0 , V_OCC_SEQ);
  112. param2.setValueParamter(1 , P_BEF_ORD_NO);
  113. param2.setValueParamter(2 , P_BEF_ORD_SEQ);
  114. param2.setValueParamter(3 , P_ORD_NO);
  115. param2.setValueParamter(4 , P_ORD_SEQ);
  116. param2.setValueParamter(5 , P_BEF_PROG_CD);
  117. param2.setValueParamter(6 , P_PROG_CD);
  118. param2.setValueParamter(7 , P_MAT_TYPE);
  119. param2.setValueParamter(8 , P_MAT_NO);
  120. param2.setValueParamter(9 , P_WGT);
  121. param2.setValueParamter(10, P_PGMID);
  122. param2.setValueParamter(11, P_REG_ID);
  123. int InsCnt = getDao("mesdao").insert("NIE012070_ORDSTS.insert",param2);
  124. if (InsCnt == 0) {
  125. V_TABLE_ID = "TBE02_ORDSTS";
  126. V_TABLE_MODE = "I";
  127. V_ERR_DESC = "TBE02_ORDSTS INSERT COUNT IS ZERO";
  128. V_RTN_NAME = "SaveOrdSts TBE02_ORDSTS INSERT " + V_OCC_SEQ;
  129. LogGpError.logMessageToDB("SaveOrdSts", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME);
  130. throw new PosException(V_RTN_NAME);
  131. }
  132. }
  133. }
  134. catch (PosException ex)
  135. {
  136. context.put(SERVICE_ERR_MSG, ex.getMessage());
  137. throw ex;
  138. }
  139. catch (Throwable t)
  140. {
  141. context.put(SERVICE_ERR_MSG, t.getMessage());
  142. throw new PosException(t.getMessage(), t);
  143. }
  144. return PosBizControlConstants.SUCCESS;
  145. }
  146. }