0ceefc4f76de7030ae50ac7dc4f55bbfaecba125.svn-base 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. package xin.glue.nui.H.H02;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.SQLException;
  5. import xin.glue.ui.common.PosDateFormat;
  6. import xin.glue.ui.common.ProduceFactory;
  7. import com.posdata.glue.PosException;
  8. import com.posdata.glue.biz.activity.PosActivity;
  9. import com.posdata.glue.biz.constants.PosBizControlConstants;
  10. import com.posdata.glue.biz.control.PosBizControlIF;
  11. import com.posdata.glue.biz.control.PosBizProvider;
  12. import com.posdata.glue.component.PosConstants;
  13. import com.posdata.glue.context.PosContext;
  14. import com.posdata.glue.dao.PosGenericDao;
  15. import com.posdata.glue.dao.vo.PosParameter;
  16. import com.posdata.glue.dao.vo.PosRow;
  17. import com.posdata.glue.dao.vo.PosRowSet;
  18. import com.posdata.glue.msg.PosMESMessageImpl;
  19. import com.posdata.glue.msg.PosMessage;
  20. public class XinSaveSlabReject extends PosActivity
  21. {
  22. public String runActivity(PosContext context)
  23. {
  24. logger.logInfo("XinSaveSlabReject START " );
  25. PosMessage message = context.getMessage();
  26. String MSG_COIL_NO = (String)message.get("COIL_NO");
  27. String MSG_SLAB_NO = (String)message.get("SLAB_NO");
  28. //这里下面没有用到,接口表中也没有 TL
  29. //String MSG_PLAN_SLAB_NO = (String)message.get("PLAN_SLAB_NO");
  30. //删除区分
  31. String MSG_MISSNO_CLF = (String)message.get("MISSNO_CLF");
  32. //删除原因代码
  33. String MSG_MISSNO_CAUSE_CD = (String)message.get("MISSNO_CAUSE_CD");
  34. //删除时间
  35. String MSG_MISSNO_OCR_DTIME = (String)message.get("MISSNO_OCR_DTIME");
  36. //处理人
  37. String MSG_MISSNO_EMP_ID = (String)message.get("MISSNO_EMP_ID");
  38. //轧制计划号
  39. String ROLL_UNIT_NO = (String)message.get("ROLL_UNIT_NO");
  40. PosDateFormat dateFormat = new PosDateFormat();
  41. String sShift = dateFormat.getShiftT(MSG_MISSNO_OCR_DTIME);
  42. logger.logInfo("XinSaveSlabReject sShift:"+sShift );
  43. PosParameter param0 = new PosParameter();
  44. param0.setWhereClauseParameter(0,MSG_SLAB_NO );
  45. param0.setWhereClauseParameter(1,MSG_COIL_NO );
  46. PosRowSet rejVo = getDao("mesdao").find("NIH020030_01.select", param0);
  47. PosParameter param1 = new PosParameter();
  48. if(rejVo.hasNext())
  49. {
  50. //这里参数不够 ROLL_UNIT_NO、SLAB_NO
  51. //这里的作用应该是通过报文自动收一次,如果没有收成功的情况下再通过界面手工录入
  52. param1.setWhereClauseParameter(0, ROLL_UNIT_NO);
  53. param1.setWhereClauseParameter(1, MSG_MISSNO_CLF);
  54. param1.setWhereClauseParameter(2, MSG_MISSNO_CAUSE_CD);
  55. param1.setWhereClauseParameter(3, MSG_MISSNO_OCR_DTIME);
  56. param1.setWhereClauseParameter(4, MSG_SLAB_NO);
  57. this.getDao("mesdao").update("NIH020030_REJ.update", param1);
  58. }
  59. else
  60. {
  61. param1.setValueParamter(0, MSG_SLAB_NO);
  62. param1.setValueParamter(1, MSG_COIL_NO);
  63. param1.setValueParamter(2, ROLL_UNIT_NO);
  64. param1.setValueParamter(3, MSG_MISSNO_CLF);
  65. param1.setValueParamter(4, MSG_MISSNO_CAUSE_CD);
  66. param1.setValueParamter(5, MSG_MISSNO_OCR_DTIME);
  67. //删除作业班次
  68. param1.setValueParamter(6, sShift);
  69. //删除作业人
  70. param1.setValueParamter(7, MSG_MISSNO_EMP_ID);
  71. this.getDao("mesdao").insert("NIH020030_REJ.insert", param1);
  72. }
  73. //如果出现多次吊销的情况,只在第一次的时候给予处理
  74. PosParameter param9 = new PosParameter();
  75. String sql9 = "select RHF_STAT from TBH02_REHEATFUR where slab_no = ? and coil_no = ? ";
  76. param9.setWhereClauseParameter(0, MSG_SLAB_NO);
  77. param9.setWhereClauseParameter(1, MSG_COIL_NO);
  78. //这里做为是否调用品质的标志
  79. String RHF_STAT = null;
  80. PosRowSet rowset9 = getDao("mesdao").findByQueryStatement(sql9, param9);
  81. if(rowset9.hasNext()){
  82. PosRow row9 = rowset9.next();
  83. RHF_STAT = (String) row9.getAttribute("RHF_STAT");
  84. logger.logInfo("XinSaveSlabReject---> 加热炉吊销的状态:"+RHF_STAT);
  85. }
  86. PosParameter param2 = new PosParameter();
  87. param2.setWhereClauseParameter(0, "2");
  88. param2.setWhereClauseParameter(1,MSG_MISSNO_CLF);
  89. param2.setWhereClauseParameter(2,MSG_MISSNO_CAUSE_CD);
  90. param2.setWhereClauseParameter(3,MSG_MISSNO_OCR_DTIME);
  91. param2.setWhereClauseParameter(4,MSG_MISSNO_EMP_ID);
  92. param2.setWhereClauseParameter(5,MSG_SLAB_NO);
  93. //改变板坯公共表中的板坯状态信息
  94. getDao("mesdao").update("UIH020020_04.update", param2);
  95. PosParameter param4 = new PosParameter();
  96. param4.setWhereClauseParameter(0,"3");
  97. param4.setWhereClauseParameter(1,MSG_SLAB_NO);
  98. param4.setWhereClauseParameter(2,MSG_COIL_NO);
  99. //这个在UIH020020中,修改的是板坯缺号状态信息。这里为了回送板坯已板坯号和钢卷号做为联合主键
  100. getDao("mesdao").update("UIH020020_07.update", param4);
  101. //调用存货异动点存储过程
  102. //ProduceFactory PD= new ProduceFactory();
  103. //PD.ErpDataCover("HSLAB", MSG_SLAB_NO,"11AZ","0","O","热轧加热炉","加回轧回");
  104. // TBH02_COIL_COMM UPDATE
  105. PosParameter param8 = new PosParameter();
  106. param8.setWhereClauseParameter(0, "");
  107. param8.setWhereClauseParameter(1,"S");
  108. param8.setWhereClauseParameter(2,MSG_MISSNO_CAUSE_CD);
  109. param8.setWhereClauseParameter(3,MSG_MISSNO_OCR_DTIME);
  110. param8.setWhereClauseParameter(4, MSG_COIL_NO); //20210817此处二级传送过来的是真实卷号不是流水号
  111. //改变板坯公共表中的板坯状态信息
  112. //getDao("mesdao").update("NIH020030_COIL.update", param8); 20210817不能使用此SQL,因为二级给的是真实卷号OLD_SAMPL_NO而不是流水号
  113. getDao("mesdao").update("NIH020030_RealCOIL.update", param8);//NIH020030_RealCOIL.update
  114. // 由计划修改,SendProg_NIF024060
  115. // PosParameter param3 = new PosParameter();
  116. // param3.setWhereClauseParameter(0, MSG_SLAB_NO );
  117. // param3.setWhereClauseParameter(1, MSG_COIL_NO );
  118. // PosRowSet specMillVo = getDao("mesdao").find("NIH020020_SPEC_MILL.select", param3);
  119. // if (specMillVo.hasNext()) {
  120. // PosRow specMillROW = specMillVo.next();
  121. // Number SLAB_EDT_SEQ = (Number)specMillROW.getAttribute("SLAB_EDT_SEQ");
  122. //
  123. // PosParameter param5 = new PosParameter();
  124. // param5.setWhereClauseParameter(0, "C" );
  125. // param5.setWhereClauseParameter(1, MSG_SLAB_NO );
  126. // param5.setWhereClauseParameter(2, MSG_COIL_NO );
  127. // getDao("mesdao").update("NIH020020_SPEC_MILL.update", param5);
  128. //
  129. // PosParameter param6 = new PosParameter();
  130. // param6.setWhereClauseParameter(0, "C" );
  131. // param6.setWhereClauseParameter(1, SLAB_EDT_SEQ );
  132. // getDao("mesdao").update("NIH020020_SPEC_MILL_D.update", param6);
  133. //
  134. // PosParameter param7 = new PosParameter();
  135. // param7.setWhereClauseParameter(0, "C" );
  136. // param7.setWhereClauseParameter(1, SLAB_EDT_SEQ );
  137. // getDao("mesdao").update("NIH020020_MILL_IDX.update", param7);
  138. //
  139. //
  140. // }
  141. //这里必须先调用求出状态,不然状态始终为3
  142. if(!RHF_STAT.equals("3")){
  143. //调用存货异动点存储过程
  144. ProduceFactory PD= new ProduceFactory();
  145. PD.ErpDataCover("HSLAB", MSG_SLAB_NO,"11AZ","0","O","热轧加热炉slab","加回轧回");
  146. //Mill schedule cancel request
  147. SendProg_NIF024060( MSG_SLAB_NO);
  148. //调用品质存储过程
  149. logger.logInfo("XinSaveSlabReject---> NIB027010 TC sql call" );
  150. CallableStatement PlRtn = getDao("mesdao").getCallableStatement("NIH020020_NIB027010");
  151. logger.logInfo("XinSaveSlabReject---> NIB027010 TC try" );
  152. try {
  153. if(PlRtn != null) {
  154. PlRtn.setString(1,MSG_COIL_NO);
  155. //新增加一个字段,为了废弃的时候使用
  156. PlRtn.setString(2,"S");
  157. PlRtn.registerOutParameter(3, java.sql.Types.VARCHAR);
  158. PlRtn.registerOutParameter(4, java.sql.Types.VARCHAR);
  159. PlRtn.execute();
  160. String sRetCode = PlRtn.getString(3);
  161. String sRetMsg = PlRtn.getString(4);
  162. logger.logInfo("XinSaveSlabReject---> NIB027010 TC PlRtn1:["+sRetCode+"]:"+ sRetMsg);
  163. } else {
  164. logger.logInfo("XinSaveSlabReject---> NIB027010 PlRtn2:"+PlRtn );
  165. }
  166. } catch (SQLException e) {
  167. throw new PosException(e.getMessage());
  168. }finally
  169. {
  170. if (PlRtn != null)
  171. {
  172. try
  173. {
  174. PlRtn.close();
  175. }
  176. catch (SQLException e)
  177. {
  178. logger.logWarn(e.getMessage(), e);
  179. logger.logInfo("XinSaveSlabReject---> NIB027010 SQLException:"+e );
  180. }
  181. }
  182. }
  183. }else{
  184. //吊销过一次的板坯,不能再次调用品质和进程
  185. logger.logInfo("XinSaveSlabReject---> 加热炉多次吊销时不允许调用品质和进程:"+RHF_STAT);
  186. }
  187. return PosBizControlConstants.SUCCESS;
  188. }
  189. public void SendProg_NIF024060(String SlabNo )
  190. {
  191. logger.logInfo("PosSaveMissionNo SendProg_NIF024060 " );
  192. PosContext context = new PosContext();
  193. PosMessage message = new PosMESMessageImpl();
  194. String TcId = "NIF024060";
  195. message.setTCID(TcId);
  196. message.setObject("MSG_ID",TcId);
  197. message.setObject("TYPE","C");
  198. message.setObject("FROM",SlabNo);
  199. message.setObject("TO",SlabNo);
  200. message.setObject("REG_ID","RHF L2");
  201. context.setMessage(message);
  202. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  203. String transactionCode = context.getMessage().getTC();
  204. message.setTCID(TcId);
  205. String serviceName = "NIF024060";
  206. String SERVICE_POSTFIX = "-service";
  207. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  208. context.setMessage(message);
  209. PosBizControlIF controller = PosBizProvider.getController();
  210. controller.doSubController(context,false);
  211. }
  212. }