a938a66bf6ff15b1ab9e2001204259c90de3f9da.svn-base 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. package xin.glue.nui.G.G02;
  2. import java.math.BigDecimal;
  3. import java.text.DateFormat;
  4. import java.text.SimpleDateFormat;
  5. import java.util.Date;
  6. import xin.glue.ui.common.PosDateFormat;
  7. import com.posdata.glue.biz.activity.PosActivity;
  8. import com.posdata.glue.biz.constants.PosBizControlConstants;
  9. import com.posdata.glue.biz.control.PosBizControlIF;
  10. import com.posdata.glue.biz.control.PosBizProvider;
  11. import com.posdata.glue.component.PosConstants;
  12. import com.posdata.glue.context.PosContext;
  13. import com.posdata.glue.dao.vo.PosParameter;
  14. import com.posdata.glue.dao.vo.PosRow;
  15. import com.posdata.glue.dao.vo.PosRowSet;
  16. import com.posdata.glue.msg.PosMESMessageImpl;
  17. import com.posdata.glue.msg.PosMessage;
  18. /*
  19. * author:wangxiaoyan
  20. * Date:08-10-28
  21. * desc:接收RH炉实绩的电文信息 更新rh炉实绩表 TBG02_RH_RESULT
  22. */
  23. public class XinSaveLFResult extends PosActivity {
  24. public String runActivity(PosContext context) {
  25. PosMessage message = context.getMessage();
  26. // 从电文中获取的数据项
  27. String RsvDate = (String) message.get("DATE");
  28. String chargeNo = (String) message.get("CHARGE_NO"); // 1 炉次号
  29. String planChargeNo = (String) message.get("PLAN_CHARGE_NO"); // 2
  30. // 炉次计划号
  31. BigDecimal arrvWgt = (BigDecimal) message.get("ARRV_WGT"); // 3 处理前钢水重量
  32. BigDecimal lfTreatWgt = (BigDecimal) message.get("LF_TREAT_WGT"); // 4
  33. // LF处理后重量
  34. BigDecimal slagThk = (BigDecimal) message.get("SLAG_THK"); // 5 炉渣厚度
  35. BigDecimal slagWgt = (BigDecimal) message.get("SLAG_WGT"); // 6 渣量
  36. String lfArrvDtime = (String) message.get("LF_ARRV_DTIME"); // 7 LF 到达时刻
  37. String lfStaDtime = (String) message.get("LF_STA_DTIME"); // 8 LF 开始时刻
  38. String lfEndDtime = (String) message.get("LF_END_DTIME"); // 9 LF 完成时刻
  39. String lfDepDtime = (String) message.get("LF_DEP_DTIME"); // 10LF 出发时刻
  40. String elecflowStaDtime = (String) message.get("ELECFLOW_STA_DTIME"); // 11通电开始时刻
  41. BigDecimal lfTreatHour = (BigDecimal) message.get("LF_TREAT_HOUR"); // 12LF处理时间
  42. BigDecimal arGasBlowHour = (BigDecimal) message.get("AR_GAS_BLOW_HOUR"); // 13氩气吹入时间
  43. BigDecimal lfWaitHour = (BigDecimal) message.get("LF_WAIT_HOUR"); // 14LF
  44. // 待机时间
  45. BigDecimal elecflowHour = (BigDecimal) message.get("ELECFLOW_HOUR"); // 15通电时间
  46. BigDecimal elecflowWgt = (BigDecimal) message.get("ELECFLOW_WGT"); // 16通电量
  47. BigDecimal lfArrvTemp = (BigDecimal) message.get("LF_ARRV_TEMP"); // 17LF
  48. // 到达温度
  49. BigDecimal lfStaTemp = (BigDecimal) message.get("LF_STA_TEMP"); // 18LF
  50. // 开始温度
  51. String lfEndTemp = (String) message.get("LF_END_TEMP"); // 19LF 完成温度
  52. String lfDepTemp = (String) message.get("LF_DEP_TEMP"); // 20LF 出发温度
  53. BigDecimal treatBefO2Wgt = (BigDecimal) message.get("TREAT_BEF_O2_WGT"); // 21LF
  54. // 开始时含氧量
  55. BigDecimal treatAftO2Wgt = (BigDecimal) message.get("TREAT_AFT_O2_WGT"); // 22LF
  56. // 结束时含氧量
  57. BigDecimal o2UseWgt = (BigDecimal) message.get("O2_USE_WGT"); // 23氧气用量
  58. BigDecimal arGasUseWgt = (BigDecimal) message.get("AR_GAS_USE_WGT"); // 24Ar
  59. // GAS
  60. // 使用量
  61. BigDecimal electrodContactQnty1 = (BigDecimal) message
  62. .get("ELECTROD_CONTACT_QNTY_1"); // 25电极通电次数 1极
  63. BigDecimal electrodContactQnty2 = (BigDecimal) message
  64. .get("ELECTROD_CONTACT_QNTY_2"); // 26电极通电次数 2极
  65. BigDecimal electrodContactQnty3 = (BigDecimal) message
  66. .get("ELECTROD_CONTACT_QNTY_3"); // 27电极通电次数3极
  67. String lfNo = (String) message.get("LF_NO"); // 28LF炉号
  68. int chLth = chargeNo.trim().length();
  69. if (chLth < 10 ) {
  70. logger.logError("XinSaveLFResult CHARGE_NO ERROR !!!!-->"+chargeNo );
  71. return PosBizControlConstants.SUCCESS;
  72. }
  73. String sShift = null;
  74. if (RsvDate == null || RsvDate.equals("")) {
  75. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  76. RsvDate = formatter.format(new Date());
  77. }
  78. sShift = PosDateFormat.getShift(RsvDate);
  79. PosParameter paramA = new PosParameter();
  80. paramA.setWhereClauseParameter(0, RsvDate.substring(0, 6));
  81. paramA.setWhereClauseParameter(1, RsvDate.substring(6, 8));
  82. paramA.setWhereClauseParameter(2, sShift);
  83. paramA.setWhereClauseParameter(3, "S");
  84. PosRowSet groupVO = this.getDao("mesdao").find(
  85. "NIG020210_SHIFT.select", paramA);
  86. String sGroup = null;
  87. if (groupVO.hasNext()) {
  88. PosRow groupROW = groupVO.next();
  89. sGroup = (String) groupROW.getAttribute("GR_GROUP_CD");
  90. }
  91. PosParameter param0 = new PosParameter();
  92. PosParameter param1 = new PosParameter();
  93. // PosParameter param2 = new PosParameter();
  94. // 用电文接收的数据项修改 LF炉实绩表 tbg02_rh_result
  95. param0.setWhereClauseParameter(0, chargeNo);
  96. PosRowSet LfRstVO = this.getDao("mesdao").find("NIG020510_01.select",
  97. param0);
  98. if (LfRstVO.hasNext()) {
  99. param1.setValueParamter(0, planChargeNo); // 1 炉次计划号
  100. param1.setValueParamter(1, arrvWgt); // 2 处理前钢水重量
  101. param1.setValueParamter(2, lfTreatWgt); // 3 LF处理后重量
  102. param1.setValueParamter(3, slagThk); // 4 炉渣厚度
  103. param1.setValueParamter(4, slagWgt); // 5 渣量
  104. param1.setValueParamter(5, lfArrvDtime); // 6 LF 到达时刻
  105. param1.setValueParamter(6, lfStaDtime); // 7 LF 开始时刻
  106. param1.setValueParamter(7, lfEndDtime); // 8 LF 完成时刻
  107. param1.setValueParamter(8, lfDepDtime); // 9 LF 出发时刻
  108. param1.setValueParamter(9, elecflowStaDtime); // 10通电开始时刻
  109. param1.setValueParamter(10, lfTreatHour); // 11LF处理时间
  110. param1.setValueParamter(11, arGasBlowHour); // 12氩气吹入时间
  111. param1.setValueParamter(12, lfWaitHour); // 13LF 待机时间
  112. param1.setValueParamter(13, elecflowHour); // 14通电时间
  113. param1.setValueParamter(14, elecflowWgt); // 15通电量
  114. param1.setValueParamter(15, lfArrvTemp); // 16LF 到达温度
  115. param1.setValueParamter(16, lfStaTemp); // 17LF 开始温度
  116. param1.setValueParamter(17, lfEndTemp); // 18LF 完成温度
  117. param1.setValueParamter(18, lfDepTemp); // 19LF 出发温度
  118. param1.setValueParamter(19, treatBefO2Wgt); // 20LF 开始时含氧量
  119. param1.setValueParamter(20, treatAftO2Wgt); // 21LF 结束时含氧量
  120. param1.setValueParamter(21, o2UseWgt); // 22氧气用量
  121. param1.setValueParamter(22, arGasUseWgt); // 23Ar GAS 使用量
  122. param1.setValueParamter(23, electrodContactQnty1); // 24电极通电次数 1极
  123. param1.setValueParamter(24, electrodContactQnty2); // 25电极通电次数 2极
  124. param1.setValueParamter(25, electrodContactQnty3); // 26电极通电次数3极
  125. param1.setValueParamter(26, lfNo); // 27lf炉机号
  126. param1.setValueParamter(27, sShift); // 27lf炉机号
  127. param1.setValueParamter(28, sGroup); // 27lf炉机号
  128. param1.setValueParamter(29, RsvDate.substring(0, 8)); // 27lf炉机号
  129. param1.setValueParamter(30, chargeNo); // 28炉次号
  130. this.getDao("mesdao").update("NIG020510_01.update", param1);
  131. } else {
  132. param1.setValueParamter(0, chargeNo); // 1 炉次号
  133. param1.setValueParamter(1, planChargeNo); // 2 炉次计划号
  134. param1.setValueParamter(2, arrvWgt); // 3 处理前钢水重量
  135. param1.setValueParamter(3, lfTreatWgt); // 4 LF处理后重量
  136. param1.setValueParamter(4, slagThk); // 5 炉渣厚度
  137. param1.setValueParamter(5, slagWgt); // 6 渣量
  138. param1.setValueParamter(6, lfArrvDtime); // 7 LF 到达时刻
  139. param1.setValueParamter(7, lfStaDtime); // 8 LF 开始时刻
  140. param1.setValueParamter(8, lfEndDtime); // 9 LF 完成时刻
  141. param1.setValueParamter(9, lfDepDtime); // 10 LF 出发时刻
  142. param1.setValueParamter(10, elecflowStaDtime); // 11 通电开始时刻
  143. param1.setValueParamter(11, lfTreatHour); // 12 LF处理时间
  144. param1.setValueParamter(12, arGasBlowHour); // 13 氩气吹入时间
  145. param1.setValueParamter(13, lfWaitHour); // 14 LF 待机时间
  146. param1.setValueParamter(14, elecflowHour); // 15 通电时间
  147. param1.setValueParamter(15, elecflowWgt); // 16 通电量
  148. param1.setValueParamter(16, lfArrvTemp); // 17 LF 到达温度
  149. param1.setValueParamter(17, lfStaTemp); // 18 LF 开始温度
  150. param1.setValueParamter(18, lfEndTemp); // 19 LF 完成温度
  151. param1.setValueParamter(19, lfDepTemp); // 20 LF 出发温度
  152. param1.setValueParamter(20, treatBefO2Wgt); // 21 LF 开始时含氧量
  153. param1.setValueParamter(21, treatAftO2Wgt); // 22 LF 结束时含氧量
  154. param1.setValueParamter(22, o2UseWgt); // 23 氧气用量
  155. param1.setValueParamter(23, arGasUseWgt); // 24 Ar GAS 使用量
  156. param1.setValueParamter(24, electrodContactQnty1); // 25 电极通电次数 1极
  157. param1.setValueParamter(25, electrodContactQnty2); // 26 电极通电次数 2极
  158. param1.setValueParamter(26, electrodContactQnty3); // 27 电极通电次数3极
  159. param1.setValueParamter(27, lfNo); // 27lf炉机号
  160. param1.setValueParamter(28, sShift); // 27lf炉机号
  161. param1.setValueParamter(29, sGroup); // 27lf炉机号
  162. param1.setValueParamter(30, RsvDate.substring(0, 8)); // 27lf炉机号
  163. this.getDao("mesdao").insert("NIG020510_01.insert", param1);
  164. String BefProg = null;
  165. String ChargeStat = null;
  166. String PlanhargeNo = null;
  167. PosParameter paramZ = new PosParameter();
  168. paramZ.setWhereClauseParameter(0, chargeNo);
  169. PosRowSet chargeVO = this.getDao("mesdao").find("NIG020210_03.select", paramZ);
  170. if (chargeVO.hasNext()) {
  171. PosRow chargeROW = chargeVO.next();
  172. BefProg = (String) chargeROW.getAttribute("CUR_PROG_CD");
  173. ChargeStat = (String) chargeROW.getAttribute("CHARGE_STAT");
  174. PlanhargeNo = (String)chargeROW.getAttribute("PLAN_CHARGE_NO");
  175. }
  176. if (ChargeStat != null && ChargeStat.equals("2") && PlanhargeNo != null) {
  177. PosParameter param5 = new PosParameter();
  178. String sProgCd = "JLF";
  179. param5.setValueParamter(0, sProgCd);
  180. param5.setValueParamter(1, "B");
  181. param5.setValueParamter(2, PlanhargeNo);
  182. this.getDao("mesdao").update("NIG020200_SPEC_PROG.update",param5);
  183. SendProg_NIE012070(planChargeNo, BefProg, lfTreatWgt);
  184. SendProg_NIE012080();
  185. }
  186. }
  187. return PosBizControlConstants.SUCCESS;
  188. }
  189. public PosContext SendProg_NIE012070(String ChargeNo, String BefProg,
  190. BigDecimal wgt) {
  191. logger.logDebug("XinSaveLfResult SendProg_NIE012070 ");
  192. PosContext context = new PosContext();
  193. PosMessage message = new PosMESMessageImpl();
  194. String TcId = "NIE012070";
  195. message.setTCID(TcId);
  196. message.setObject("MSG_ID", TcId);
  197. message.setObject("BEF_ORD_NO", null);
  198. message.setObject("BEF_ORD_SEQ", null);
  199. message.setObject("ORD_NO", null);
  200. message.setObject("ORD_SEQ", null);
  201. message.setObject("BEF_PROG_CD", BefProg);
  202. message.setObject("PROG_CD", "JLF");
  203. message.setObject("MAT_TYPE", "CH");
  204. message.setObject("MAT_NO", ChargeNo);
  205. message.setObject("WGT", wgt);
  206. message.setObject("PGMID", "XinSaveLfResult");
  207. message.setObject("REG_ID", "LEVEL2");
  208. context.setMessage(message);
  209. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  210. String transactionCode = context.getMessage().getTC();
  211. logger.logDebug("XinSaveLfResult---> transactionCode:("
  212. + transactionCode + ")");
  213. message.setTCID(TcId);
  214. String serviceName = "NIE012070";
  215. String SERVICE_POSTFIX = "-service";
  216. context.put(PosBizControlConstants.SERVICE_NAME, serviceName
  217. + SERVICE_POSTFIX);
  218. context.setMessage(message);
  219. PosBizControlIF controller = PosBizProvider.getController();
  220. controller.doSubController(context, false);
  221. logger.logDebug("XinSaveLfResult---> NIE012070 TC SendProgress end");
  222. return null;
  223. }
  224. public PosContext SendProg_NIE012080() {
  225. logger.logDebug("XinSaveLfResult SendProg_NIE012080 ");
  226. PosContext context = new PosContext();
  227. PosMessage message = new PosMESMessageImpl();
  228. String TcId = "NIE012080";
  229. message.setTCID(TcId);
  230. message.setObject("MSG_ID", TcId);
  231. message.setObject("AA", null);
  232. context.setMessage(message);
  233. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  234. String transactionCode = context.getMessage().getTC();
  235. logger.logDebug("XinSaveLfResult---> transactionCode:("
  236. + transactionCode + ")");
  237. message.setTCID(TcId);
  238. String serviceName = "NIE012080";
  239. String SERVICE_POSTFIX = "-service";
  240. context.put(PosBizControlConstants.SERVICE_NAME, serviceName
  241. + SERVICE_POSTFIX);
  242. context.setMessage(message);
  243. PosBizControlIF controller = PosBizProvider.getController();
  244. controller.doSubController(context, false);
  245. logger.logDebug("XinSaveLfResult---> NIE012080 TC SendProgress end");
  246. return null;
  247. }
  248. }