1c1f1bbfdcdcc08a7b2380662d31a8c2fa566793.svn-base 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. package xin.glue.ui.G.G02;
  2. import java.math.BigDecimal;
  3. import java.sql.CallableStatement;
  4. import java.sql.SQLException;
  5. import com.posdata.glue.PosException;
  6. import com.posdata.glue.biz.activity.PosActivity;
  7. import com.posdata.glue.biz.constants.PosBizControlConstants;
  8. import com.posdata.glue.biz.control.PosBizControlIF;
  9. import com.posdata.glue.biz.control.PosBizProvider;
  10. import com.posdata.glue.context.PosContext;
  11. import com.posdata.glue.dao.PosGenericDao;
  12. import com.posdata.glue.dao.vo.PosParameter;
  13. import com.posdata.glue.dao.vo.PosRow;
  14. import com.posdata.glue.dao.vo.PosRowSet;
  15. import com.posdata.glue.msg.PosMESMessageImpl;
  16. import com.posdata.glue.msg.PosMessage;
  17. public class PosUpdateCutSchedu extends PosActivity {
  18. public String runActivity(PosContext context) {
  19. logger.logInfo("PosUpdateCutSchedu start");
  20. CallableStatement cstm = null;
  21. PosGenericDao dao = this.getDao("mesdao");
  22. String P_RTN_MSG = "";
  23. String[] rowStatus = (String[]) context.get("rowStatus");
  24. String[] CHK = (String[]) context.get("CHK");
  25. String[] SLAB_NO = (String[]) context.get("SLAB_NO");
  26. String[] sMoveFl = (String[])context.get("MoveFl");
  27. String[] ChargeNo = (String[])context.get("NxtChargeNo");
  28. //获取移动之前 后一炉次的切割计划信息
  29. String[] orlPlanChargeNo = new String[40];
  30. String[] orlPlanSlabNo = null;
  31. String[] orlCastNo = null;
  32. BigDecimal[] orlCastChargeSeq = null;
  33. BigDecimal[] orlCastChargeCnt = null;
  34. String[] orlStlGrd = null;
  35. String[] orlSpecAbbsym = null;
  36. BigDecimal[] orlSlabThk = null;
  37. BigDecimal[] orlSlabWth = null;
  38. BigDecimal[] orlSlabLen = null;
  39. String[] orlHcrClf = null;
  40. String oralInsCharge = null;
  41. if(sMoveFl[0].equals("I")){
  42. oralInsCharge = "3" + SLAB_NO[0].substring(1, 10);
  43. }else if(sMoveFl[0].equals("D")){
  44. oralInsCharge = "3" + ChargeNo[0].substring(1, 10);
  45. }else{
  46. context.put("MESSAGES", "ERRORS");
  47. return PosBizControlConstants.SUCCESS;
  48. }
  49. logger.logInfo("NxtChargeNo --" + oralInsCharge);
  50. PosParameter para = new PosParameter();
  51. para.setWhereClauseParameter(0, oralInsCharge);
  52. PosRowSet orlChargeRowSet = getDao("mesdao").find("UIG020061_ORAL_CHARGE_NO.select", para);
  53. if(!(orlChargeRowSet.hasNext())){
  54. context.put("MESSAGES"," 移动炉号有错!");
  55. return PosBizControlConstants.SUCCESS;
  56. }
  57. String fst = SLAB_NO[0].substring(0, 10) + "010";
  58. String scd = ChargeNo[0] + "010";
  59. para = new PosParameter();
  60. para.setWhereClauseParameter(0, fst);
  61. para.setWhereClauseParameter(1, scd);
  62. PosRowSet rowset = getDao("mesdao").find("UIG020061_REPLACE_CHECK.select", para);
  63. if(!(rowset.hasNext())){
  64. context.put("MESSAGES","ERROR");
  65. return PosBizControlConstants.SUCCESS;
  66. }
  67. String sSlabCnt = null;
  68. String sSlabNo[] = new String[9];
  69. String sChargeNo = null;
  70. String sReturnCd = null;
  71. String sReturnMsg = null;
  72. String orlChargeNo = null;
  73. sChargeNo = ChargeNo[0];
  74. int tempTag = 0;
  75. if(rowStatus.length > 9){
  76. context.put("MESSAGES","ERRORS");
  77. return "SUCCESS";
  78. }
  79. for(int i = 0 ; i < rowStatus.length ; i++){
  80. if(CHK[i].equals("N"))continue;
  81. if(SLAB_NO[i] == null && SLAB_NO[i].equals("")){
  82. return "SUCCESS";
  83. }
  84. sSlabNo[i] = SLAB_NO[i];
  85. tempTag++;
  86. orlChargeNo = SLAB_NO[i].substring(0,10);
  87. }
  88. sSlabCnt = tempTag + "";
  89. for(int i = 0 ; i < sSlabNo.length ; i++){
  90. if(sSlabNo[i]== null)sSlabNo[i] = "";
  91. }
  92. System.out.println(sMoveFl[0] + "----" + sSlabCnt + "----" +sChargeNo);
  93. System.out.println(sSlabNo[0] + "----" + sSlabNo[1] + "----" +sSlabNo[2]);
  94. System.out.println(sSlabNo[3] + "----" + sSlabNo[4] + "----" +sSlabNo[5]);
  95. System.out.println(sSlabNo[6] + "----" + sSlabNo[7] + "----" +sSlabNo[8]);
  96. try{
  97. cstm = dao.getCallableStatement("NIG020061_01.CALLSTATEMENT");
  98. cstm.setString(1, sMoveFl[0]);
  99. cstm.setString(2, sSlabCnt);
  100. cstm.setString(3, sSlabNo[0]);
  101. cstm.setString(4, sSlabNo[1]);
  102. cstm.setString(5, sSlabNo[2]);
  103. cstm.setString(6, sSlabNo[3]);
  104. cstm.setString(7, sSlabNo[4]);
  105. cstm.setString(8, sSlabNo[5]);
  106. cstm.setString(9, sSlabNo[6]);
  107. cstm.setString(10, sSlabNo[7]);
  108. cstm.setString(11, sSlabNo[8]);
  109. cstm.setString(12, sChargeNo);
  110. cstm.registerOutParameter(13, java.sql.Types.VARCHAR);
  111. cstm.registerOutParameter(14, java.sql.Types.VARCHAR);
  112. cstm.execute();
  113. sReturnCd = cstm.getString(13);
  114. sReturnMsg = cstm.getString(14);
  115. System.out.println("------------> " + sReturnCd + "-----------" + sReturnMsg);
  116. }catch(Exception ex){
  117. logger.logError(ex.getMessage(), ex);
  118. }finally
  119. {
  120. if (cstm != null)
  121. {
  122. try
  123. {
  124. cstm.close();
  125. }
  126. catch (SQLException e)
  127. {
  128. logger.logWarn(e.getMessage(), e);
  129. }
  130. }
  131. }
  132. if(sMoveFl[0].equals("I")){
  133. PosParameter param = new PosParameter();
  134. // 移动的板坯块数 插入到前一炉最后
  135. int moveSlabCnt = getDao("mesdao").insert("UIG020061_SLAB_CUT_INS_01.insert", param);
  136. //后一炉次切割信息修改
  137. getDao("mesdao").insert("UIG020061_SLAB_CUT_INS_02.insert", param);
  138. for(int i = 0 ; i < moveSlabCnt ; i++){
  139. PosRow orlCharRow = orlChargeRowSet.next();
  140. param = new PosParameter();
  141. param.setValueParamter(0, (String)orlCharRow.getAttribute("CHARGE_MANA_NO"));
  142. param.setValueParamter(1, "3" + ((String)orlCharRow.getAttribute("SLAB_MANA_NO")).substring(1, 13));
  143. param.setValueParamter(2, (String)orlCharRow.getAttribute("CAST_MANA_NO"));
  144. param.setValueParamter(3, (BigDecimal)orlCharRow.getAttribute("CAST_EDT_CHARGE_CNT"));
  145. param.setValueParamter(4, (BigDecimal)orlCharRow.getAttribute("CAST_CHARGE_SEQ"));
  146. param.setValueParamter(5, (String)orlCharRow.getAttribute("STL_GRD"));
  147. param.setValueParamter(6, (String)orlCharRow.getAttribute("SPEC_ABBSYM"));
  148. param.setValueParamter(7, (BigDecimal)orlCharRow.getAttribute("SLAB_THK"));
  149. param.setValueParamter(8, (BigDecimal)orlCharRow.getAttribute("SLAB_WTH"));
  150. param.setValueParamter(9, (BigDecimal)orlCharRow.getAttribute("SLAB_LEN"));
  151. param.setValueParamter(10, (String)orlCharRow.getAttribute("HCR_CLF"));
  152. getDao("mesdao").insert("UIG020061_SLAB_CUT_INS_03.insert", param);
  153. }
  154. }else if(sMoveFl[0].equals("D")){
  155. PosParameter param = new PosParameter();
  156. // 移动的板坯块数 插入到后一炉最前面
  157. int nxtChgSlabCnt = 0;
  158. BigDecimal updtSlabCnt = null;
  159. int moveSlabCnt = getDao("mesdao").insert("UIG020061_SLAB_CUT_INS_01.insert", param);
  160. BigDecimal istSlabCnt = new BigDecimal(moveSlabCnt);
  161. param = new PosParameter();
  162. PosRowSet slabCntRowSet = getDao("mesdao").find("UIG020061_MOVE_SLAB_CNT.select", param);
  163. if(slabCntRowSet.hasNext()){
  164. PosRow slabCnt = slabCntRowSet.next();
  165. nxtChgSlabCnt = ((BigDecimal)slabCnt.getAttribute("SLAB_CNT")).intValue();
  166. logger.logInfo("-----------------BegDecimal to int slabCnt" + nxtChgSlabCnt);
  167. }else{
  168. logger.logError(" ERRORS ------移动板坯数据错误!");
  169. }
  170. updtSlabCnt = new BigDecimal(nxtChgSlabCnt - moveSlabCnt);
  171. logger.logInfo("---------updtSlabCnt" + updtSlabCnt + "--------istSlabCnt" + istSlabCnt);
  172. param = new PosParameter();
  173. param.setValueParamter(0, updtSlabCnt);
  174. getDao("mesdao").insert("UIG020061_SLAB_CUT_INS_04.insert", param);
  175. param = new PosParameter();
  176. param.setValueParamter(0, istSlabCnt);
  177. getDao("mesdao").insert("UIG020061_SLAB_CUT_INS_05.insert", param);
  178. }
  179. if(sReturnCd.equals("YY")){
  180. String befProg = "";
  181. BigDecimal wgt = null;
  182. PosParameter param = new PosParameter();
  183. param.setWhereClauseParameter(0, orlChargeNo);
  184. PosRowSet rowSet = getDao("mesdao").find("UIG020061_CHARGE_COMM.select",param);
  185. if(rowSet.hasNext()){
  186. PosRow row = rowSet.next();
  187. befProg = (String)row.getAttribute("CUR_PROG_CD");
  188. wgt = (BigDecimal)row.getAttribute("CHARGE_WGT");
  189. }
  190. SendProg_NIE012070(orlChargeNo,befProg,wgt);
  191. befProg = "";
  192. wgt = null;
  193. param = new PosParameter();
  194. param.setWhereClauseParameter(0, orlChargeNo);
  195. rowSet = getDao("mesdao").find("UIG020061_CHARGE_COMM.select",param);
  196. if(rowSet.hasNext()){
  197. PosRow row = rowSet.next();
  198. befProg = (String)row.getAttribute("CUR_PROG_CD");
  199. wgt = (BigDecimal)row.getAttribute("CHARGE_WGT");
  200. }
  201. SendProg_NIE012070(sChargeNo,befProg,wgt);
  202. SendProg_NIE012080();
  203. }
  204. context.put("MESSAGES",sReturnCd);
  205. return PosBizControlConstants.SUCCESS;
  206. }
  207. public PosContext SendProg_NIE012070(String ChargeNo,String BefProg,Number wgt )
  208. {
  209. logger.logInfo("XinSaveBofResult wgt:"+wgt );
  210. // BigDecimal wgt = new BigDecimal();
  211. PosContext context = new PosContext();
  212. PosMessage message = new PosMESMessageImpl();
  213. String TcId = "NIE012070";
  214. message.setTCID(TcId);
  215. message.setObject("MSG_ID",TcId);
  216. message.setObject("BEF_ORD_NO",null);
  217. message.setObject("BEF_ORD_SEQ",null);
  218. message.setObject("ORD_NO",null);
  219. message.setObject("ORD_SEQ",null);
  220. message.setObject("BEF_PROG_CD","JBB");
  221. message.setObject("PROG_CD","JBF");
  222. message.setObject("MAT_TYPE","CH");
  223. message.setObject("MAT_NO",ChargeNo);
  224. message.setObject("WGT", wgt );
  225. message.setObject("PGMID","XinSaveBoFResult");
  226. message.setObject("REG_ID","LEVEL2");
  227. message.setTCID(TcId);
  228. context.setMessage(message);
  229. // this.processComponent(PosConstants.CREATE_MESSAGE, context);
  230. // String transactionCode = context.getMessage().getTC();
  231. String serviceName = "NIE012070";
  232. String SERVICE_POSTFIX = "-service";
  233. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  234. // context.setMessage(message);
  235. PosBizControlIF controller = PosBizProvider.getController();
  236. controller.doSubController(context,false);
  237. logger.logInfo("XinSaveBofResult---> NIE012070 TC SendProgress end" );
  238. return null;
  239. }
  240. public PosContext SendProg_NIE012080()
  241. {
  242. logger.logInfo("XinSaveBofResult SendProg_NIE012080 " );
  243. PosContext context = new PosContext();
  244. PosMessage message = new PosMESMessageImpl();
  245. String TcId = "NIE012080";
  246. message.setTCID(TcId);
  247. message.setObject("MSG_ID",TcId);
  248. message.setObject("AA",null);
  249. message.setTCID(TcId);
  250. context.setMessage(message);
  251. // this.processComponent(PosConstants.CREATE_MESSAGE, context);
  252. // String transactionCode = context.getMessage().getTC();
  253. String serviceName = "NIE012080";
  254. String SERVICE_POSTFIX = "-service";
  255. context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
  256. // context.setMessage(message);
  257. PosBizControlIF controller = PosBizProvider.getController();
  258. controller.doSubController(context,false);
  259. logger.logInfo("XinSaveBofResult---> NIE012080 TC SendProgress end" );
  260. return null;
  261. }
  262. }