bb837db9f6369413fbb8f7b86925b940e658168a.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  1. package xin.glue.nui.H.H02;
  2. import java.math.BigDecimal;
  3. import com.posdata.glue.biz.activity.PosActivity;
  4. import com.posdata.glue.biz.constants.PosBizControlConstants;
  5. import com.posdata.glue.biz.control.PosBizControlIF;
  6. import com.posdata.glue.biz.control.PosBizProvider;
  7. import com.posdata.glue.component.PosConstants;
  8. import com.posdata.glue.context.PosContext;
  9. import com.posdata.glue.dao.vo.PosParameter;
  10. import com.posdata.glue.dao.vo.PosRow;
  11. import com.posdata.glue.dao.vo.PosRowSet;
  12. import com.posdata.glue.msg.PosMESMessageImpl;
  13. import com.posdata.glue.msg.PosMessage;
  14. import com.posdata.glue.util.log.PosLog;
  15. import com.posdata.glue.util.log.PosLogFactory;
  16. public class XinSaveWorkBeam extends PosActivity
  17. {
  18. private final PosLog log = PosLogFactory.getLogger(getClass());
  19. public String runActivity(PosContext context)
  20. {
  21. log.logInfo("======== XinSaveWorkBeam START " );
  22. //从界面直接给出实际卷号
  23. PosMessage message = context.getMessage();
  24. String[] QCOIL = new String[4];
  25. String[][] WKB = new String[11][4];
  26. String[][] CCOIL = new String[4][9];
  27. QCOIL[0] = (String)message.get("QCOIL_CHAIN1_COIL_NO");
  28. QCOIL[1] = (String)message.get("QCOIL_CHAIN2_COIL_NO");
  29. QCOIL[2] = (String)message.get("QCOIL_CHAIN3_COIL_NO");
  30. QCOIL[3] = (String)message.get("QCOIL_CHAIN4_COIL_NO");
  31. WKB[0][0] = (String)message.get("WKB1_COIL_NO1");
  32. WKB[0][1] = (String)message.get("WKB1_COIL_NO2");
  33. WKB[1][0] = (String)message.get("WKB2_COIL_NO1");
  34. WKB[1][1] = (String)message.get("WKB2_COIL_NO2");
  35. WKB[1][2] = (String)message.get("WKB2_COIL_NO3");
  36. WKB[1][3] = (String)message.get("WKB2_COIL_NO4");
  37. WKB[2][0] = (String)message.get("WKB3_COIL_NO1");
  38. WKB[2][1] = (String)message.get("WKB3_COIL_NO2");
  39. WKB[2][2] = (String)message.get("WKB3_COIL_NO3");
  40. WKB[2][3] = (String)message.get("WKB3_COIL_NO4");
  41. WKB[3][0] = (String)message.get("WKB4_COIL_NO1");
  42. WKB[3][1] = (String)message.get("WKB4_COIL_NO2");
  43. WKB[3][2] = (String)message.get("WKB4_COIL_NO3");
  44. WKB[3][3] = (String)message.get("WKB4_COIL_NO4");
  45. WKB[4][0] = (String)message.get("WKB5_COIL_NO1");
  46. WKB[4][1] = (String)message.get("WKB5_COIL_NO2");
  47. WKB[4][2] = (String)message.get("WKB5_COIL_NO3");
  48. WKB[5][0] = (String)message.get("WKB6_COIL_NO1");
  49. WKB[5][1] = (String)message.get("WKB6_COIL_NO2");
  50. WKB[5][2] = (String)message.get("WKB6_COIL_NO3");
  51. WKB[5][3] = (String)message.get("WKB6_COIL_NO4");
  52. WKB[6][0] = (String)message.get("WKB7_COIL_NO1");
  53. WKB[6][1] = (String)message.get("WKB7_COIL_NO2");
  54. WKB[6][2] = (String)message.get("WKB7_COIL_NO3");
  55. WKB[6][3] = (String)message.get("WKB7_COIL_NO4");
  56. WKB[7][0] = (String)message.get("WKB8_COIL_NO1");
  57. WKB[7][1] = (String)message.get("WKB8_COIL_NO2");
  58. WKB[8][0] = (String)message.get("WKB9_COIL_NO1");
  59. WKB[8][1] = (String)message.get("WKB9_COIL_NO2");
  60. WKB[9][0] = (String)message.get("WKB10_COIL_NO1");
  61. WKB[9][1] = (String)message.get("WKB10_COIL_NO2");
  62. WKB[10][0] = (String)message.get("WKB11_COIL_NO1");
  63. WKB[10][1] = (String)message.get("WKB11_COIL_NO2");
  64. CCOIL[0][0] = (String)message.get("CCOIL_CHAIN1_COIL_NO1");
  65. CCOIL[0][1] = (String)message.get("CCOIL_CHAIN1_COIL_NO2");
  66. CCOIL[0][2] = (String)message.get("CCOIL_CHAIN1_COIL_NO3");
  67. CCOIL[0][3] = (String)message.get("CCOIL_CHAIN1_COIL_NO4");
  68. CCOIL[0][4] = (String)message.get("CCOIL_CHAIN1_COIL_NO5");
  69. CCOIL[0][5] = (String)message.get("CCOIL_CHAIN1_COIL_NO6");
  70. CCOIL[0][6] = (String)message.get("CCOIL_CHAIN1_COIL_NO7");
  71. CCOIL[0][7] = (String)message.get("CCOIL_CHAIN1_COIL_NO8");
  72. CCOIL[0][8] = (String)message.get("CCOIL_CHAIN1_COIL_NO9");
  73. CCOIL[1][0] = (String)message.get("CCOIL_CHAIN2_COIL_NO1");
  74. CCOIL[1][1] = (String)message.get("CCOIL_CHAIN2_COIL_NO2");
  75. CCOIL[1][2] = (String)message.get("CCOIL_CHAIN2_COIL_NO3");
  76. CCOIL[1][3] = (String)message.get("CCOIL_CHAIN2_COIL_NO4");
  77. CCOIL[1][4] = (String)message.get("CCOIL_CHAIN2_COIL_NO5");
  78. CCOIL[1][5] = (String)message.get("CCOIL_CHAIN2_COIL_NO6");
  79. CCOIL[1][6] = (String)message.get("CCOIL_CHAIN2_COIL_NO7");
  80. CCOIL[1][7] = (String)message.get("CCOIL_CHAIN2_COIL_NO8");
  81. CCOIL[1][8] = (String)message.get("CCOIL_CHAIN2_COIL_NO9");
  82. CCOIL[2][0] = (String)message.get("CCOIL_CHAIN3_COIL_NO1");
  83. CCOIL[2][1] = (String)message.get("CCOIL_CHAIN3_COIL_NO2");
  84. CCOIL[2][2] = (String)message.get("CCOIL_CHAIN3_COIL_NO3");
  85. CCOIL[2][3] = (String)message.get("CCOIL_CHAIN3_COIL_NO4");
  86. CCOIL[2][4] = (String)message.get("CCOIL_CHAIN3_COIL_NO5");
  87. CCOIL[2][5] = (String)message.get("CCOIL_CHAIN3_COIL_NO6");
  88. CCOIL[2][6] = (String)message.get("CCOIL_CHAIN3_COIL_NO7");
  89. CCOIL[2][7] = (String)message.get("CCOIL_CHAIN3_COIL_NO8");
  90. CCOIL[2][8] = (String)message.get("CCOIL_CHAIN3_COIL_NO9");
  91. CCOIL[3][0] = (String)message.get("CCOIL_CHAIN4_COIL_NO1");
  92. CCOIL[3][1] = (String)message.get("CCOIL_CHAIN4_COIL_NO2");
  93. CCOIL[3][2] = (String)message.get("CCOIL_CHAIN4_COIL_NO3");
  94. CCOIL[3][3] = (String)message.get("CCOIL_CHAIN4_COIL_NO4");
  95. CCOIL[3][4] = (String)message.get("CCOIL_CHAIN4_COIL_NO5");
  96. String MSG_DTIME = (String)message.get("MSG_DTIME");
  97. String StepClf = null;
  98. String YardClf = null;
  99. String OldSampleNo = null;
  100. int i = 0;int j = 0;
  101. for ( i =0 ; i < 4 ; i++ ) {
  102. if (QCOIL[i] != null && !QCOIL[i].equals("")) {
  103. // PosParameter paramA = new PosParameter();
  104. //
  105. // paramA.setWhereClauseParameter(0, QCOIL[i] );
  106. // PosRowSet coilCommVO = this.getDao("mesdao").find("NIH020070_COIL_COM.select", paramA);
  107. //if (coilCommVO.hasNext() ) {
  108. // PosRow coilCommROW = coilCommVO.next();
  109. //
  110. // OldSampleNo = (String)coilCommROW.getAttribute("OLD_SAMPL_NO");
  111. //这里从界面直接传过来实际卷号,不需要使用转换
  112. PosParameter param = new PosParameter();
  113. StepClf = "0"+String.valueOf(i+1);
  114. param.setWhereClauseParameter(0, QCOIL[i]);
  115. param.setWhereClauseParameter(1, MSG_DTIME);
  116. param.setWhereClauseParameter(2, "MILL L1");
  117. param.setWhereClauseParameter(3, StepClf);
  118. this.getDao("mesdao").update("NIH020070_B00.update", param);
  119. //}
  120. }
  121. if (i == 0) {
  122. //屏蔽自动制定行车命令
  123. //SendProg_NIH050010(CCOIL[i][j],"B");
  124. }
  125. }
  126. OldSampleNo = null;
  127. int k = 0;
  128. StepClf = null;
  129. for ( i =0 ; i < 11 ; i++ ) {
  130. if ( i == 0) {
  131. k = 2;
  132. } else if ( i == 1) {
  133. k = 4;
  134. } else if ( i == 2) {
  135. k = 4;
  136. } else if ( i == 3) {
  137. k = 4;
  138. } else if ( i == 4) {
  139. k = 3;
  140. } else if ( i == 5) {
  141. k = 4;
  142. } else if ( i == 6) {
  143. k = 4;
  144. } else if ( i == 7) {
  145. k = 2;
  146. } else if ( i == 8) {
  147. k = 2;
  148. } else if ( i == 9) {
  149. k = 2;
  150. } else if ( i == 10) {
  151. k = 2;
  152. }
  153. for ( j =0 ; j < k ; j++ ) {
  154. if (WKB[i][j] != null && !WKB[i][j].equals("")) {
  155. //从界面直接输入钢卷号,不需要通过流水号转换
  156. // PosParameter paramB = new PosParameter();
  157. //
  158. // paramB.setWhereClauseParameter(0, WKB[i][j] );
  159. // PosRowSet coilCommVO = this.getDao("mesdao").find("NIH020070_COIL_COM.select", paramB);
  160. //if (coilCommVO.hasNext()) {
  161. // PosRow coilCommROW = coilCommVO.next();
  162. //
  163. // OldSampleNo = (String)coilCommROW.getAttribute("OLD_SAMPL_NO");
  164. PosParameter param1 = new PosParameter();
  165. if (i > 8) {
  166. YardClf = "B"+String.valueOf(i+1);
  167. } else {
  168. YardClf = "B0"+String.valueOf(i+1);
  169. }
  170. StepClf = "0"+String.valueOf(j+1);
  171. //直接使用钢卷号
  172. param1.setWhereClauseParameter(0, WKB[i][j]);
  173. param1.setWhereClauseParameter(1, MSG_DTIME);
  174. param1.setWhereClauseParameter(2, "MILL L1");
  175. param1.setWhereClauseParameter(3, YardClf);
  176. param1.setWhereClauseParameter(4, StepClf);
  177. this.getDao("mesdao").update("NIH020070_WKB.update", param1);
  178. //}
  179. }
  180. }
  181. }
  182. OldSampleNo = null;
  183. k = 0;
  184. for (i = 0; i < 4; i++) {
  185. if (i == 3 ) {
  186. k = 4;
  187. } else {
  188. k = 9;
  189. }
  190. for (j = 0; j < k; j++) {
  191. if (CCOIL[i][j] != null && !CCOIL[i][j].equals("")) {
  192. PosParameter paramC = new PosParameter();
  193. // paramC.setWhereClauseParameter(0, CCOIL[i][j] );
  194. // PosRowSet coilCommVO = this.getDao("mesdao").find("NIH020070_COIL_COM.select", paramC);
  195. //if (coilCommVO.hasNext()) {
  196. // PosRow coilCommROW = coilCommVO.next();
  197. //
  198. // OldSampleNo = (String)coilCommROW.getAttribute("OLD_SAMPL_NO");
  199. PosParameter param2 = new PosParameter();
  200. YardClf = "C0"+String.valueOf(i+1);
  201. StepClf = "0"+String.valueOf(j+1);
  202. param2.setWhereClauseParameter(0, CCOIL[i][j]);
  203. param2.setWhereClauseParameter(1, MSG_DTIME);
  204. param2.setWhereClauseParameter(2, "MILL L1");
  205. param2.setWhereClauseParameter(3, YardClf);
  206. param2.setWhereClauseParameter(4, StepClf);
  207. this.getDao("mesdao").update("NIH020070_WKB.update", param2);
  208. //}
  209. }
  210. }
  211. }
  212. return PosBizControlConstants.SUCCESS;
  213. }
  214. public void SendProg_NIH050010(String CoilNo,String CurPos)
  215. {
  216. PosContext context = new PosContext();
  217. PosMessage message = new PosMESMessageImpl();
  218. String TcId = "NIH050010";
  219. message.setTCID(TcId);
  220. message.setObject("MSG_ID",TcId);
  221. message.setObject("COIL_NO",CoilNo);
  222. message.setObject("CURR_POS",null);
  223. context.setMessage(message);
  224. this.processComponent(PosConstants.CREATE_MESSAGE, context);
  225. String transactionCode = context.getMessage().getTC();
  226. message.setTCID(TcId);
  227. String serviceName = TcId;
  228. String SERVICE_POSTFIX = "-service";
  229. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  230. context.setMessage(message);
  231. PosBizControlIF controller = PosBizProvider.getController();
  232. controller.doSubController(context,false);
  233. }
  234. }