10db9bdbe327e44150dae68c23bd2fb5453043e2.svn-base 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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:
  22. */
  23. public class XinSaveCasResult extends PosActivity {
  24. public String runActivity(PosContext context) {
  25. PosMessage message = context.getMessage();
  26. String RsvDate = (String) message.get("DATE");
  27. // String msgId = (String) message.get("MSG_ID");
  28. // String date = (String) message.get("DATE");
  29. // String seqNo = (String) message.get("SEQ_NO");
  30. // String reserve = (String) message.get("RESERVE");
  31. String chargeNo = (String) message.get("CHARGE_NO");
  32. String planChargeNo = (String) message.get("PLAN_CHARGE_NO");
  33. // String stlGrd = (String) message.get("STL_GRD");
  34. // String specAbbsym = (String) message.get("SPEC_ABBSYM");
  35. String casNo = (String) message.get("CAS_NO");
  36. BigDecimal casTreatCnt = (BigDecimal) message.get("CAS_TREAT_CNT");
  37. BigDecimal arrvWgt = (BigDecimal) message.get("ARRV_WGT");
  38. BigDecimal casTreatWgt = (BigDecimal) message.get("CAS_TREAT_WGT");
  39. BigDecimal slagThk = (BigDecimal) message.get("SLAG_THK");
  40. String casArrvDtime = (String) message.get("CAS_ARRV_DTIME");
  41. String casStaDtime = (String) message.get("CAS_STA_DTIME");
  42. String casEndDtime = (String) message.get("CAS_END_DTIME");
  43. String casDepDtime = (String) message.get("CAS_DEP_DTIME");
  44. BigDecimal casTreatHour = (BigDecimal) message.get("CAS_TREAT_HOUR");
  45. BigDecimal arGasBlowHour = (BigDecimal) message.get("AR_GAS_BLOW_HOUR");
  46. BigDecimal casArrvTemp = (BigDecimal) message.get("CAS_ARRV_TEMP");
  47. BigDecimal casStaTemp = (BigDecimal) message.get("CAS_STA_TEMP");
  48. BigDecimal casEndTemp = (BigDecimal) message.get("CAS_END_TEMP");
  49. BigDecimal casDepTemp = (BigDecimal) message.get("CAS_DEP_TEMP");
  50. BigDecimal treatBefO2Wgt = (BigDecimal) message.get("TREAT_BEF_O2_WGT");
  51. BigDecimal treatAftO2Wgt = (BigDecimal) message.get("TREAT_AFT_O2_WGT");
  52. BigDecimal arGasuseWgt = (BigDecimal) message.get("AR_GAS_USE_WGT");
  53. int chLth = chargeNo.trim().length();
  54. if (chLth < 10 ) {
  55. logger.logError("XinSaveCasResult CHARGE_NO ERROR !!!!-->"+chargeNo );
  56. return PosBizControlConstants.SUCCESS;
  57. }
  58. String sShift = null;
  59. if (RsvDate == null || RsvDate.equals("")) {
  60. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  61. RsvDate = formatter.format(new Date());
  62. }
  63. sShift = PosDateFormat.getShift(RsvDate);
  64. PosParameter paramA = new PosParameter();
  65. paramA.setWhereClauseParameter(0, RsvDate.substring(0, 6));
  66. paramA.setWhereClauseParameter(1, RsvDate.substring(6, 8));
  67. paramA.setWhereClauseParameter(2, sShift);
  68. paramA.setWhereClauseParameter(3, "S");
  69. PosRowSet groupVO = this.getDao("mesdao").find( "NIG020210_SHIFT.select", paramA);
  70. String sGroup = null;
  71. if (groupVO.hasNext()) {
  72. PosRow groupROW = groupVO.next();
  73. sGroup = (String) groupROW.getAttribute("GR_GROUP_CD");
  74. }
  75. PosParameter param0 = new PosParameter();
  76. PosParameter param1 = new PosParameter();
  77. // PosParameter param2 = new PosParameter();
  78. param0.setWhereClauseParameter(0, chargeNo);
  79. PosRowSet rowset0 = this.getDao("mesdao").find("NIG020410_01.select",param0);
  80. if (rowset0.hasNext()) {
  81. param1.setValueParamter(0, planChargeNo);
  82. param1.setValueParamter(1, casNo);
  83. param1.setValueParamter(2, casTreatCnt);
  84. param1.setValueParamter(3, arrvWgt);
  85. param1.setValueParamter(4, casTreatWgt);
  86. param1.setValueParamter(5, slagThk);
  87. param1.setValueParamter(6, casArrvDtime);
  88. param1.setValueParamter(7, casStaDtime);
  89. param1.setValueParamter(8, casEndDtime);
  90. param1.setValueParamter(9, casDepDtime);
  91. param1.setValueParamter(10, casTreatHour);
  92. param1.setValueParamter(11, arGasBlowHour);
  93. param1.setValueParamter(12, casArrvTemp);
  94. param1.setValueParamter(13, casStaTemp);
  95. param1.setValueParamter(14, casEndTemp);
  96. param1.setValueParamter(15, casDepTemp);
  97. param1.setValueParamter(16, treatBefO2Wgt);
  98. param1.setValueParamter(17, treatAftO2Wgt);
  99. param1.setValueParamter(18, arGasuseWgt);
  100. param1.setValueParamter(19, sShift);
  101. param1.setValueParamter(20, sGroup);
  102. param1.setValueParamter(21, RsvDate.substring(0, 8));
  103. param1.setValueParamter(22, chargeNo);
  104. this.getDao("mesdao").update("NIG020410_01.update", param1);
  105. } else {
  106. param1.setValueParamter(0, chargeNo);
  107. param1.setValueParamter(1, planChargeNo);
  108. param1.setValueParamter(2, casNo);
  109. param1.setValueParamter(3, casTreatCnt);
  110. param1.setValueParamter(4, arrvWgt);
  111. param1.setValueParamter(5, casTreatWgt);
  112. param1.setValueParamter(6, slagThk);
  113. param1.setValueParamter(7, casArrvDtime);
  114. param1.setValueParamter(8, casStaDtime);
  115. param1.setValueParamter(9, casEndDtime);
  116. param1.setValueParamter(10, casDepDtime);
  117. param1.setValueParamter(11, casTreatHour);
  118. param1.setValueParamter(12, arGasBlowHour);
  119. param1.setValueParamter(13, casArrvTemp);
  120. param1.setValueParamter(14, casStaTemp);
  121. param1.setValueParamter(15, casEndTemp);
  122. param1.setValueParamter(16, casDepTemp);
  123. param1.setValueParamter(17, treatBefO2Wgt);
  124. param1.setValueParamter(18, treatAftO2Wgt);
  125. param1.setValueParamter(19, arGasuseWgt);
  126. param1.setValueParamter(20, sShift);
  127. param1.setValueParamter(21, sGroup);
  128. param1.setValueParamter(22, RsvDate.substring(0, 8));
  129. this.getDao("mesdao").insert("NIG020410_01.insert", param1);
  130. String BefProg = "JBF";
  131. String ChargeStat = null;
  132. String PlanhargeNo = null;
  133. PosParameter paramZ = new PosParameter();
  134. paramZ.setWhereClauseParameter(0, chargeNo);
  135. PosRowSet chargeVO = this.getDao("mesdao").find("NIG020210_03.select", paramZ);
  136. if (chargeVO.hasNext()) {
  137. PosRow chargeROW = chargeVO.next();
  138. ChargeStat = (String) chargeROW.getAttribute("CHARGE_STAT");
  139. PlanhargeNo = (String)chargeROW.getAttribute("PLAN_CHARGE_NO");
  140. }
  141. if (ChargeStat != null && ChargeStat.equals("2") && PlanhargeNo != null) {
  142. PosParameter param5 = new PosParameter();
  143. String sProgCd = "JCF";
  144. param5.setValueParamter(0, sProgCd);
  145. param5.setValueParamter(1, "B");
  146. param5.setValueParamter(2, PlanhargeNo);
  147. this.getDao("mesdao").update("NIG020200_SPEC_PROG.update",param5);
  148. SendProg_NIE012070(planChargeNo, BefProg, casTreatWgt);
  149. SendProg_NIE012080();
  150. }
  151. }
  152. return PosBizControlConstants.SUCCESS;
  153. }
  154. public PosContext SendProg_NIE012070(String ChargeNo, String BefProg,
  155. BigDecimal wgt) {
  156. logger.logDebug("XinSaveCasResult SendProg_NIE012070 wgt:" + wgt);
  157. PosContext context = new PosContext();
  158. PosMessage message = new PosMESMessageImpl();
  159. String TcId = "NIE012070";
  160. message.setTCID(TcId);
  161. message.setObject("MSG_ID", TcId);
  162. message.setObject("BEF_ORD_NO", null);
  163. message.setObject("BEF_ORD_SEQ", null);
  164. message.setObject("ORD_NO", null);
  165. message.setObject("ORD_SEQ", null);
  166. message.setObject("BEF_PROG_CD", BefProg);
  167. message.setObject("PROG_CD", "JCF");
  168. message.setObject("MAT_TYPE", "CH");
  169. message.setObject("MAT_NO", ChargeNo);
  170. message.setObject("WGT", wgt);
  171. message.setObject("PGMID", "XinSaveCasResult");
  172. message.setObject("REG_ID", "LEVEL2");
  173. context.setMessage(message);
  174. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  175. String transactionCode = context.getMessage().getTC();
  176. logger.logDebug("XinSaveCasResult---> transactionCode:("
  177. + transactionCode + ")");
  178. message.setTCID(TcId);
  179. String serviceName = "NIE012070";
  180. String SERVICE_POSTFIX = "-service";
  181. context.put(PosBizControlConstants.SERVICE_NAME, serviceName
  182. + SERVICE_POSTFIX);
  183. context.setMessage(message);
  184. PosBizControlIF controller = PosBizProvider.getController();
  185. controller.doSubController(context, false);
  186. logger.logDebug("XinSaveCasResult---> NIE012070 TC SendProgress end");
  187. return null;
  188. }
  189. public PosContext SendProg_NIE012080() {
  190. logger.logDebug("XinSaveCasResult SendProg_NIE012080 ");
  191. PosContext context = new PosContext();
  192. PosMessage message = new PosMESMessageImpl();
  193. String TcId = "NIE012080";
  194. message.setTCID(TcId);
  195. message.setObject("MSG_ID", TcId);
  196. message.setObject("AA", null);
  197. context.setMessage(message);
  198. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  199. String transactionCode = context.getMessage().getTC();
  200. logger.logDebug("XinSaveCasResult---> transactionCode:("
  201. + transactionCode + ")");
  202. message.setTCID(TcId);
  203. String serviceName = "NIE012080";
  204. String SERVICE_POSTFIX = "-service";
  205. context.put(PosBizControlConstants.SERVICE_NAME, serviceName
  206. + SERVICE_POSTFIX);
  207. context.setMessage(message);
  208. PosBizControlIF controller = PosBizProvider.getController();
  209. controller.doSubController(context, false);
  210. logger.logDebug("XinSaveCasResult---> NIE012080 TC SendProgress end");
  211. return null;
  212. }
  213. }