0dde3b4e6c05c9ab30bc36d78ecb928db23a208c.svn-base 6.6 KB

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