014ec52db8cf8ef33e8f345bda06a5b78153e2e9.svn-base 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. package xin.glue.nui.E.E03;
  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 RepSaveQZ extends PosActivity {
  17. String P_RTN_MSG = "";
  18. String V_MAT_TYPE = "";
  19. public String runActivity(PosContext context) {
  20. String[] rowStatus = (String[]) context.get("rowStatus");
  21. String[] V_MAT_NO = (String[]) context.get("DSP_NO");
  22. String[] P_REG_ID = (String[]) context.get("P_REG_ID");
  23. String[] V_ORD_NO = (String[]) context.get("R_ORD_NO");
  24. String[] V_ORD_SEQ = (String[]) context.get("R_ORD_SEQ");
  25. String[] V_SIGN_STL = (String[]) context.get("SIGN_STL");
  26. String[] V_SIGN_CHEN_FEN = (String[]) context.get("SIGN_CHEN_FEN");
  27. String[] V_SING_CAIZHI = (String[]) context.get("SING_CAIZHI");
  28. String[] V_SIGN_QIANGZHI = (String[]) context.get("SIGN_QIANGZHI");
  29. P_REG_ID[0] = (P_REG_ID == null || "".equals(P_REG_ID[0])) ? " no user "
  30. : P_REG_ID[0];
  31. for (int i = 0; i < rowStatus.length; i++) {
  32. CallableStatement cStmt = null;
  33. PosRowSet MatVO = null;
  34. cStmt = this.getDao("mesdao").getCallableStatement(
  35. "callNIE03_SERVEAS");
  36. try {
  37. if (cStmt != null) {
  38. cStmt.setString(1, V_MAT_NO[i]);
  39. cStmt.setString(2, V_ORD_NO[0]);
  40. cStmt.setString(3, V_ORD_SEQ[0]);
  41. cStmt.setString(4, V_SIGN_STL[0]);
  42. cStmt.setString(5, V_SIGN_CHEN_FEN[0]);
  43. cStmt.setString(6, V_SING_CAIZHI[0]);
  44. cStmt.setString(7, V_SIGN_QIANGZHI[0]);
  45. cStmt.setString(8, P_REG_ID[0]);
  46. cStmt.registerOutParameter(9, Types.VARCHAR);
  47. cStmt.execute();
  48. P_RTN_MSG = cStmt.getString(9);
  49. // NIF024050_CALL(P_TYPE,P_ST,P_EN);
  50. }
  51. } catch (SQLException e) {
  52. // e.printStackTrace();
  53. logger.logError(e.getMessage());
  54. context.put("errorMsg", e.getMessage());
  55. return PosBizControlConstants.FAILURE;
  56. //throw new PosException(e.getMessage());
  57. //logger.logError(e);
  58. //isSuccess = false;
  59. } finally {
  60. if (cStmt != null) {
  61. try {
  62. cStmt.close();
  63. } catch (SQLException e) {
  64. logger.logWarn(e.getMessage(), e);
  65. }
  66. }
  67. }
  68. if (P_RTN_MSG == null || "".equals(P_RTN_MSG)) {
  69. ;
  70. } else {
  71. logger.logError(P_RTN_MSG);
  72. context.put("errorMsg", P_RTN_MSG);
  73. return PosBizControlConstants.FAILURE;
  74. }
  75. PosParameter param = new PosParameter();
  76. param.setWhereClauseParameter(0, V_MAT_NO[i]);
  77. if ('J' == (V_MAT_NO[0].charAt(0))) {
  78. V_MAT_TYPE = "TM";
  79. MatVO = getDao("mesdao")
  80. .find("UIF031046_SlabInf.select", param);
  81. } else if ('R' == (V_MAT_NO[0].charAt(0))) {
  82. V_MAT_TYPE = "AR";
  83. MatVO = getDao("mesdao")
  84. .find("UIF031046_CoilInf.select", param);
  85. } else {
  86. }
  87. MatVO.reset();
  88. while (MatVO.hasNext()) {
  89. PosRow MatInfRow = MatVO.next();
  90. String LV_MAT_NO = (String) MatInfRow.getAttribute("MAT_NO");
  91. long LV_MAT_WGT = Long.parseLong((MatInfRow
  92. .getAttribute("MAT_WGT") == null ? "0" : MatInfRow
  93. .getAttribute("MAT_WGT")).toString());
  94. String LV_BEF_ORD_NO = (String) MatInfRow
  95. .getAttribute("ORG_ORD_NO") == null ? ""
  96. : (String) MatInfRow.getAttribute("ORG_ORD_NO");
  97. String LV_BEF_PROG_CD = (String) MatInfRow
  98. .getAttribute("BEF_PROG_CD") == null ? ""
  99. : (String) MatInfRow.getAttribute("BEF_PROG_CD");
  100. String LV_BEF_ORD_SEQ = (String) MatInfRow
  101. .getAttribute("ORG_ORD_SEQ") == null ? ""
  102. : (String) MatInfRow.getAttribute("ORG_ORD_SEQ");
  103. String LV_CUR_PROG_CD = (String) MatInfRow
  104. .getAttribute("CUR_PROG_CD") == null ? ""
  105. : (String) MatInfRow.getAttribute("CUR_PROG_CD");
  106. // CALL NIE012070_SaveOrdSts
  107. NIE012070_CALL(LV_MAT_NO, LV_MAT_WGT, V_ORD_NO[0],
  108. V_ORD_SEQ[0], LV_BEF_ORD_NO, LV_BEF_ORD_SEQ,
  109. LV_BEF_PROG_CD, LV_CUR_PROG_CD, V_MAT_TYPE, P_REG_ID[0]);
  110. } // SlabInfVO while END
  111. }
  112. NIE012080_CALL();
  113. if (new OrdChk(V_ORD_NO[0], V_ORD_SEQ[0]).isOver()) {
  114. throw new PosException("¶©µ¥³¬Á¿...RepSaveQZ.OrdChk.isOver..."
  115. + V_ORD_NO[0] + " - " + V_ORD_SEQ[0]);
  116. }
  117. ;
  118. return PosBizControlConstants.SUCCESS;
  119. }
  120. public PosContext NIE012070_CALL(String P_MAT_NO, long V_WGT,
  121. String V_ORD_NO, String V_ORD_SEQ, String P_BEF_ORD_NO,
  122. String P_BEF_ORD_SEQ, String P_BEF_PROG_CD, String P_CUR_PROG_CD,
  123. String P_MAT_TYPE, String V_REG_ID) {
  124. PosContext context = new PosContext();
  125. PosMessage message = new PosMESMessageImpl();
  126. // SaveOrdSts
  127. String TcId = "NIE012070";
  128. message.setTCID(TcId);
  129. message.setObject("MSG_ID", TcId);
  130. message.setObject("BEF_ORD_NO", P_BEF_ORD_NO);
  131. message.setObject("BEF_ORD_SEQ", P_BEF_ORD_SEQ);
  132. message.setObject("ORD_NO", V_ORD_NO);
  133. message.setObject("ORD_SEQ", V_ORD_SEQ);
  134. message.setObject("BEF_PROG_CD", P_BEF_PROG_CD);
  135. message.setObject("PROG_CD", P_CUR_PROG_CD);
  136. message.setObject("MAT_TYPE", P_MAT_TYPE);
  137. message.setObject("MAT_NO", P_MAT_NO);
  138. message.setObject("WGT", new BigDecimal(V_WGT));
  139. message.setObject("PGMID", "OrdRepSaveQZ");
  140. message.setObject("REG_ID", V_REG_ID);
  141. context.setMessage(message);
  142. message.setTCID(TcId);
  143. String SERVICE_POSTFIX = "-service";
  144. context
  145. .put(PosBizControlConstants.SERVICE_NAME, TcId
  146. + SERVICE_POSTFIX);
  147. PosBizProvider.getController().doSubController(context, false);
  148. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  149. if (SERVICE_ERR_MSG != null) {
  150. throw new PosException(SERVICE_ERR_MSG);
  151. }
  152. return context;
  153. }
  154. public PosContext NIE012080_CALL() {
  155. PosContext context = new PosContext();
  156. PosMessage message = new PosMESMessageImpl();
  157. // OrdStsMain
  158. String TcId = "NIE012080";
  159. message.setTCID(TcId);
  160. message.setObject("MSG_ID", TcId);
  161. message.setObject("AA", "");
  162. context.setMessage(message);
  163. message.setTCID(TcId);
  164. String SERVICE_POSTFIX = "-service";
  165. context
  166. .put(PosBizControlConstants.SERVICE_NAME, TcId
  167. + SERVICE_POSTFIX);
  168. PosBizProvider.getController().doSubController(context, false);
  169. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  170. if (SERVICE_ERR_MSG != null) {
  171. throw new PosException(SERVICE_ERR_MSG);
  172. }
  173. return context;
  174. }
  175. }