2baf1fbc05a67446fb7fc229eece554cb337aaad.svn-base 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. package xin.glue.ui.D.D08;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.SQLException;
  5. import java.sql.Types;
  6. import java.util.ArrayList;
  7. import java.util.HashMap;
  8. import java.util.List;
  9. import java.util.Map;
  10. import com.posdata.glue.PosException;
  11. import com.posdata.glue.biz.activity.PosActivity;
  12. import com.posdata.glue.biz.constants.PosBizControlConstants;
  13. import com.posdata.glue.biz.control.PosBizProvider;
  14. import com.posdata.glue.context.PosContext;
  15. import com.posdata.glue.dao.vo.PosRow;
  16. import com.posdata.glue.dao.vo.PosRowSet;
  17. import com.posdata.glue.msg.PosMESMessageImpl;
  18. import com.posdata.glue.msg.PosMessage;
  19. /**
  20. *
  21. * @author 王黎
  22. * @date 2010-01-21
  23. */
  24. public class UpdateRollWorkSlabByTianShi extends PosActivity
  25. {
  26. public String runActivity(PosContext context)
  27. {
  28. String[] slabNo1 = (String[]) context.get("slabNo1"); //计划中的板坯号
  29. String[] slabNo2 = (String[]) context.get("slabNo2"); //可以替换的板坯号
  30. String[] reg_id = (String[]) context.get("REG_ID");
  31. String useName = "";
  32. if(reg_id != null)
  33. {
  34. if(reg_id[0] == "" || "".equals(reg_id[0]))
  35. {
  36. useName = "UID08";
  37. }
  38. else
  39. {
  40. useName = reg_id[0];
  41. }
  42. }
  43. else
  44. {
  45. useName = "UID08";
  46. }
  47. // if(slabNo1 != null && slabNo2 != null && !"".equals(slabNo1[0]) && !"".equals(slabNo2[0]))
  48. // {
  49. // if(!checkSlabStat(slabNo1[0],slabNo2[0]))
  50. // {
  51. // context.put("errorData", "板坯状态已变化,请刷新您查询的轧制计划!!!");
  52. // return PosBizControlConstants.SUCCESS;
  53. // }
  54. // }
  55. CallableStatement cStmt = null;
  56. try {
  57. //替换现在的存储过程
  58. // cStmt = this.getDao("mesdao").getCallableStatement("L2SENDREPLACE.REP_L2_SEND_MAIN");
  59. cStmt = this.getDao("mesdao").getCallableStatement("UID080010_CALL");
  60. cStmt.setString(1, slabNo1[0]);
  61. cStmt.setString(2, slabNo2[0]);
  62. cStmt.setString(3, useName);
  63. cStmt.registerOutParameter(4, Types.VARCHAR);
  64. cStmt.execute();
  65. context.put("AYY", cStmt.getString(4));
  66. // System.out.println("############################"+ cStmt.getString(1));
  67. } catch (Exception e) {
  68. return PosBizControlConstants.FAILURE;
  69. } finally {
  70. if (cStmt != null)
  71. {
  72. try
  73. {
  74. cStmt.close();
  75. }
  76. catch (Exception e)
  77. {
  78. logger.logWarn(e.getMessage(), e);
  79. return PosBizControlConstants.FAILURE;
  80. }
  81. }
  82. }
  83. // NIE012080_CALL(); zhushi by mgp 2014/3/11
  84. return PosBizControlConstants.SUCCESS;
  85. }
  86. /**
  87. * //板坯替换时候检查板坯状态是否正确,避免出现同一轧制计划中出现两块板坯的现象
  88. */
  89. public boolean checkSlabStat(String slabNo1, String slabNo2)
  90. {
  91. //String sql = "";
  92. boolean falg = true;
  93. PosRowSet posRowSet = null;
  94. PosRowSet posRowSet2 = null;
  95. PosRow posRow = null;
  96. PosRow posRow2 = null;
  97. Map map = new HashMap();
  98. Map map2 = new HashMap();
  99. String coufac = "";
  100. String sqlOne = "SELECT COUNT(*) SLABYN FROM TBF02_SPEC_MILL A WHERE A.SLAB_NO = '"+slabNo1+"' AND A.STATUS_CD = 'A'";
  101. posRowSet = getDao("mesdao").findByQueryStatement(sqlOne);
  102. while (posRowSet.hasNext())
  103. {
  104. posRow = (PosRow) posRowSet.next();
  105. map = posRow.getAttributes();
  106. coufac = ((BigDecimal)map.get("SLABYN")).toString();
  107. if("0".equals(coufac))
  108. {
  109. falg = false;
  110. break;
  111. }
  112. }
  113. if(falg)
  114. {
  115. String sqlTwo = "SELECT COUNT(*) SLABYN FROM TBF02_SPEC_MILL A WHERE A.SLAB_NO = '"+slabNo2+"' AND A.STATUS_CD IN ('A','B') ";
  116. posRowSet2 = getDao("mesdao").findByQueryStatement(sqlTwo);
  117. while (posRowSet2.hasNext())
  118. {
  119. posRow2 = (PosRow) posRowSet2.next();
  120. map2 = posRow2.getAttributes();
  121. coufac = ((BigDecimal)map2.get("SLABYN")).toString();
  122. if(!"0".equals(coufac))
  123. {
  124. falg = false;
  125. break;
  126. }
  127. }
  128. }
  129. return falg;//最终返回TURE则表示验证通过。为FALSE则验证不通过。
  130. }
  131. public PosContext NIE012080_CALL()
  132. {
  133. PosContext context = new PosContext();
  134. PosMessage message = new PosMESMessageImpl();
  135. //OrdStsMain
  136. String TcId = "NIE012080";
  137. message.setTCID(TcId);
  138. message.setObject("MSG_ID", TcId);
  139. message.setObject("AA", "");
  140. context.setMessage(message);
  141. message.setTCID(TcId);
  142. String SERVICE_POSTFIX = "-service";
  143. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  144. PosBizProvider.getController().doSubController(context, false);
  145. String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG");
  146. if (SERVICE_ERR_MSG != null)
  147. {
  148. throw new PosException(SERVICE_ERR_MSG);
  149. }
  150. return context;
  151. }
  152. }