bc56c56ffc3cba760f3eee75f7e5d51d0585626b.svn-base 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278
  1. package xin.glue.ui.G.G04;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.SQLException;
  5. import java.text.DateFormat;
  6. import java.text.SimpleDateFormat;
  7. import java.util.Date;
  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.vo.PosParameter;
  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. * @auth: wangxiaoyan
  21. * @date: 2009-2-17
  22. * @desc: 板坯部分废钢实绩
  23. */
  24. public class XinSaveScrapSlab extends PosActivity {
  25. public String runActivity(PosContext context) {
  26. String SIZE_UPDT_CAUSE_CD = "05"; // RESIZE UPDATE
  27. String[] SLAB_THK = (String[])context.get("SLAB_THK");
  28. String[] SLAB_WTH = (String[])context.get("SLAB_WTH");
  29. String[] SLAB_LEN = (String[])context.get("SLAB_LEN");
  30. String[] SLAB_WGT = (String[])context.get("SLAB_WGT");
  31. String[] SIZE_UPDT_BEF_THK = (String[])context.get("SIZE_UPDT_BEF_THK");
  32. String[] SIZE_UPDT_BEF_WTH = (String[])context.get("SIZE_UPDT_BEF_WTH");
  33. String[] SIZE_UPDT_BEF_LEN = (String[])context.get("SIZE_UPDT_BEF_LEN");
  34. String[] SIZE_UPDT_BEF_WGT = (String[])context.get("SIZE_UPDT_BEF_WGT");
  35. String[] SIZE_UPDT_AFT_THK = (String[])context.get("SLAB_THK");
  36. String[] SIZE_UPDT_AFT_WTH = (String[])context.get("SLAB_WTH");
  37. String[] SIZE_UPDT_AFT_LEN = (String[])context.get("SLAB_LEN");
  38. String[] SIZE_UPDT_AFT_WGT = (String[])context.get("SLAB_WGT");
  39. String[] SIZE_UPDT_WKSHIFT = (String[])context.get("WKSHIFT");
  40. String[] SIZE_UPDT_WKGROUP = (String[])context.get("GROUP");
  41. String[] SIZE_UPDT_EMP_NO = (String[])context.get("REG_ID");
  42. String[] SLAB_SIZE_DEC_GRD = (String[])context.get("SIZE_DEC_FL");
  43. String[] SLAB_NO = (String[])context.get("SLAB_NO");
  44. String[] SCRAP_WGT = (String[])context.get("SCRAP_WGT");
  45. //String matrlEndCauseCd = "05"; // scrap
  46. PosParameter param1 = new PosParameter();
  47. param1.setWhereClauseParameter(0, SLAB_NO[0]);
  48. PosRowSet slabComVo = getDao("mesdao").find("UIG040070_04.select", param1);
  49. String OrdNo = null;
  50. String OrdSeq = null;
  51. String OrdFl = null;
  52. String CurProgCd = null;
  53. String BefProgCd = null;
  54. String BefOrdNo = null;
  55. String BefOrdSeq = null;
  56. String NonOrdResCd = null;
  57. String NonOrdResDate = null;
  58. String slabRt = null;
  59. if (slabComVo.hasNext()) {
  60. PosRow slabComROW = slabComVo.next();
  61. OrdNo = (String)slabComROW.getAttribute("ORD_NO");
  62. OrdSeq = (String)slabComROW.getAttribute("ORD_SEQ");
  63. CurProgCd = (String)slabComROW.getAttribute("CUR_PROG_CD");
  64. OrdFl = (String)slabComROW.getAttribute("ORD_FL");
  65. slabRt = (String)slabComROW.getAttribute("SLAB_RT");
  66. }
  67. BefProgCd = CurProgCd;
  68. if(slabRt != null && (slabRt.equals("Z")||slabRt.equals("P"))){
  69. CurProgCd = "RGB";
  70. }else{
  71. CurProgCd = "RRC"; //板坯充当待机
  72. }
  73. if (OrdFl.equals("1")) {
  74. NonOrdResCd = "3A";
  75. DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
  76. NonOrdResDate = formatter.format(new Date());
  77. }
  78. OrdFl = "2";
  79. BefOrdNo = OrdNo;
  80. BefOrdSeq = OrdSeq;
  81. OrdNo = null;
  82. OrdSeq = null;
  83. PosParameter param = new PosParameter();
  84. if(SLAB_NO.length > 0){
  85. //增加降级历史记录 20101227 wxy
  86. CallableStatement cstm = null;
  87. param = new PosParameter();
  88. try{
  89. cstm = this.getDao("mesdao").getCallableStatement("ORD_HIS_INSERT.call");
  90. cstm.setString(1, "B");
  91. cstm.setString(2, "S");
  92. cstm.setString(3, "");
  93. cstm.setString(4, "UIG040070");
  94. cstm.setString(5, "");
  95. cstm.setString(6, "");
  96. cstm.setString(7, "");
  97. cstm.setString(8, SLAB_NO[0]);
  98. cstm.setString(9, "TM");
  99. cstm.setString(10, "");
  100. cstm.setString(11, "");
  101. cstm.setString(12, "");
  102. cstm.setString(13, "");
  103. cstm.execute();
  104. }catch(Exception ex){
  105. logger.logError(ex.getMessage(), ex);
  106. }finally{
  107. if (cstm != null)
  108. {
  109. try
  110. {
  111. cstm.close();
  112. }
  113. catch (SQLException e)
  114. {
  115. logger.logWarn(e.getMessage(), e);
  116. }
  117. }
  118. }
  119. //end 增加降级历史记录
  120. param.setWhereClauseParameter(0, SIZE_UPDT_CAUSE_CD);
  121. param.setWhereClauseParameter(1, SLAB_THK[0]);
  122. param.setWhereClauseParameter(2, SLAB_WTH[0]);
  123. param.setWhereClauseParameter(3, SLAB_LEN[0]);
  124. param.setWhereClauseParameter(4, SLAB_WGT[0]);
  125. param.setWhereClauseParameter(5, SIZE_UPDT_BEF_THK[0]);
  126. param.setWhereClauseParameter(6, SIZE_UPDT_BEF_WTH[0]);
  127. param.setWhereClauseParameter(7, SIZE_UPDT_BEF_LEN[0]);
  128. param.setWhereClauseParameter(8, SIZE_UPDT_BEF_WGT[0]);
  129. param.setWhereClauseParameter(9, SIZE_UPDT_AFT_THK[0]);
  130. param.setWhereClauseParameter(10, SIZE_UPDT_AFT_WTH[0]);
  131. param.setWhereClauseParameter(11, SIZE_UPDT_AFT_LEN[0]);
  132. param.setWhereClauseParameter(12, SIZE_UPDT_AFT_WGT[0]);
  133. param.setWhereClauseParameter(13, SIZE_UPDT_WKSHIFT[0]);
  134. param.setWhereClauseParameter(14, SIZE_UPDT_WKGROUP[0]);
  135. param.setWhereClauseParameter(15, SIZE_UPDT_EMP_NO[0]);
  136. param.setWhereClauseParameter(16, SCRAP_WGT[0]);
  137. param.setWhereClauseParameter(17, NonOrdResCd);
  138. param.setWhereClauseParameter(18, NonOrdResDate);
  139. param.setWhereClauseParameter(19, CurProgCd);
  140. param.setWhereClauseParameter(20, SLAB_SIZE_DEC_GRD[0]);
  141. param.setWhereClauseParameter(21, SLAB_NO[0]);
  142. this.getDao("mesdao").update("UIG040070_SIZE_CORRECT.update", param);
  143. PosParameter paramz = new PosParameter();
  144. paramz.setValueParamter(0, OrdFl);
  145. paramz.setValueParamter(1, SLAB_NO[0]);
  146. this.getDao("mesdao").update("NIG020610_SLAB_COMM_D.update",paramz);
  147. if (NonOrdResCd != null && !NonOrdResCd.equals("") ) {
  148. BigDecimal SlabWgt = new BigDecimal(SLAB_WGT[0]);
  149. SendProg_NIE012070(SLAB_NO[0],OrdNo,OrdSeq,BefOrdNo,BefOrdSeq,CurProgCd,BefProgCd,"TM",SlabWgt);
  150. SendProg_NIE012080();
  151. }
  152. }
  153. return PosBizControlConstants.SUCCESS;
  154. }
  155. public PosContext SendProg_NIE012070(String MatNo,String sOrdNo,String sOrdSeq,String sBefOrdNo,String sBefOrdSeq,String sProgCd,String BefProcCd,String sKind,BigDecimal nwgt )
  156. {
  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",sBefOrdNo);
  163. message.setObject("BEF_ORD_SEQ",sBefOrdSeq);
  164. message.setObject("ORD_NO",sOrdNo);
  165. message.setObject("ORD_SEQ",sOrdSeq);
  166. message.setObject("BEF_PROG_CD",BefProcCd);
  167. message.setObject("PROG_CD",sProgCd);
  168. message.setObject("MAT_TYPE",sKind);
  169. message.setObject("MAT_NO",MatNo);
  170. message.setObject("WGT", nwgt );
  171. message.setObject("PGMID","UIG040070");
  172. message.setObject("REG_ID","UIG040070");
  173. message.setTCID(TcId);
  174. context.setMessage(message);
  175. // this.processComponent(PosConstants.CREATE_MESSAGE, context);
  176. // String transactionCode = context.getMessage().getTC();
  177. String SERVICE_POSTFIX = "-service";
  178. context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX);
  179. // context.setMessage(message);
  180. PosBizControlIF controller = PosBizProvider.getController();
  181. controller.doSubController(context,false);
  182. return null;
  183. }
  184. public void SendProg_NIE012080()
  185. {
  186. PosContext context = new PosContext();
  187. PosMessage message = new PosMESMessageImpl();
  188. String TcId = "NIE012080";
  189. message.setTCID(TcId);
  190. message.setObject("MSG_ID",TcId);
  191. message.setObject("AA",null);
  192. context.setMessage(message);
  193. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  194. String transactionCode = context.getMessage().getTC();
  195. message.setTCID(TcId);
  196. String serviceName = "NIE012080";
  197. String SERVICE_POSTFIX = "-service";
  198. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  199. context.setMessage(message);
  200. PosBizControlIF controller = PosBizProvider.getController();
  201. controller.doSubController(context,false);
  202. }
  203. }