package xin.glue.nui.H.H02; import java.math.BigDecimal; import com.posdata.glue.biz.activity.PosActivity; import com.posdata.glue.biz.constants.PosBizControlConstants; import com.posdata.glue.biz.control.PosBizControlIF; import com.posdata.glue.biz.control.PosBizProvider; import com.posdata.glue.component.PosConstants; import com.posdata.glue.context.PosContext; import com.posdata.glue.dao.vo.PosParameter; import com.posdata.glue.dao.vo.PosRow; import com.posdata.glue.dao.vo.PosRowSet; import com.posdata.glue.msg.PosMESMessageImpl; import com.posdata.glue.msg.PosMessage; import com.posdata.glue.util.log.PosLog; import com.posdata.glue.util.log.PosLogFactory; public class XinSaveWorkBeam extends PosActivity { private final PosLog log = PosLogFactory.getLogger(getClass()); public String runActivity(PosContext context) { log.logInfo("======== XinSaveWorkBeam START " ); //从界面直接给出实际卷号 PosMessage message = context.getMessage(); String[] QCOIL = new String[4]; String[][] WKB = new String[11][4]; String[][] CCOIL = new String[4][9]; QCOIL[0] = (String)message.get("QCOIL_CHAIN1_COIL_NO"); QCOIL[1] = (String)message.get("QCOIL_CHAIN2_COIL_NO"); QCOIL[2] = (String)message.get("QCOIL_CHAIN3_COIL_NO"); QCOIL[3] = (String)message.get("QCOIL_CHAIN4_COIL_NO"); WKB[0][0] = (String)message.get("WKB1_COIL_NO1"); WKB[0][1] = (String)message.get("WKB1_COIL_NO2"); WKB[1][0] = (String)message.get("WKB2_COIL_NO1"); WKB[1][1] = (String)message.get("WKB2_COIL_NO2"); WKB[1][2] = (String)message.get("WKB2_COIL_NO3"); WKB[1][3] = (String)message.get("WKB2_COIL_NO4"); WKB[2][0] = (String)message.get("WKB3_COIL_NO1"); WKB[2][1] = (String)message.get("WKB3_COIL_NO2"); WKB[2][2] = (String)message.get("WKB3_COIL_NO3"); WKB[2][3] = (String)message.get("WKB3_COIL_NO4"); WKB[3][0] = (String)message.get("WKB4_COIL_NO1"); WKB[3][1] = (String)message.get("WKB4_COIL_NO2"); WKB[3][2] = (String)message.get("WKB4_COIL_NO3"); WKB[3][3] = (String)message.get("WKB4_COIL_NO4"); WKB[4][0] = (String)message.get("WKB5_COIL_NO1"); WKB[4][1] = (String)message.get("WKB5_COIL_NO2"); WKB[4][2] = (String)message.get("WKB5_COIL_NO3"); WKB[5][0] = (String)message.get("WKB6_COIL_NO1"); WKB[5][1] = (String)message.get("WKB6_COIL_NO2"); WKB[5][2] = (String)message.get("WKB6_COIL_NO3"); WKB[5][3] = (String)message.get("WKB6_COIL_NO4"); WKB[6][0] = (String)message.get("WKB7_COIL_NO1"); WKB[6][1] = (String)message.get("WKB7_COIL_NO2"); WKB[6][2] = (String)message.get("WKB7_COIL_NO3"); WKB[6][3] = (String)message.get("WKB7_COIL_NO4"); WKB[7][0] = (String)message.get("WKB8_COIL_NO1"); WKB[7][1] = (String)message.get("WKB8_COIL_NO2"); WKB[8][0] = (String)message.get("WKB9_COIL_NO1"); WKB[8][1] = (String)message.get("WKB9_COIL_NO2"); WKB[9][0] = (String)message.get("WKB10_COIL_NO1"); WKB[9][1] = (String)message.get("WKB10_COIL_NO2"); WKB[10][0] = (String)message.get("WKB11_COIL_NO1"); WKB[10][1] = (String)message.get("WKB11_COIL_NO2"); CCOIL[0][0] = (String)message.get("CCOIL_CHAIN1_COIL_NO1"); CCOIL[0][1] = (String)message.get("CCOIL_CHAIN1_COIL_NO2"); CCOIL[0][2] = (String)message.get("CCOIL_CHAIN1_COIL_NO3"); CCOIL[0][3] = (String)message.get("CCOIL_CHAIN1_COIL_NO4"); CCOIL[0][4] = (String)message.get("CCOIL_CHAIN1_COIL_NO5"); CCOIL[0][5] = (String)message.get("CCOIL_CHAIN1_COIL_NO6"); CCOIL[0][6] = (String)message.get("CCOIL_CHAIN1_COIL_NO7"); CCOIL[0][7] = (String)message.get("CCOIL_CHAIN1_COIL_NO8"); CCOIL[0][8] = (String)message.get("CCOIL_CHAIN1_COIL_NO9"); CCOIL[1][0] = (String)message.get("CCOIL_CHAIN2_COIL_NO1"); CCOIL[1][1] = (String)message.get("CCOIL_CHAIN2_COIL_NO2"); CCOIL[1][2] = (String)message.get("CCOIL_CHAIN2_COIL_NO3"); CCOIL[1][3] = (String)message.get("CCOIL_CHAIN2_COIL_NO4"); CCOIL[1][4] = (String)message.get("CCOIL_CHAIN2_COIL_NO5"); CCOIL[1][5] = (String)message.get("CCOIL_CHAIN2_COIL_NO6"); CCOIL[1][6] = (String)message.get("CCOIL_CHAIN2_COIL_NO7"); CCOIL[1][7] = (String)message.get("CCOIL_CHAIN2_COIL_NO8"); CCOIL[1][8] = (String)message.get("CCOIL_CHAIN2_COIL_NO9"); CCOIL[2][0] = (String)message.get("CCOIL_CHAIN3_COIL_NO1"); CCOIL[2][1] = (String)message.get("CCOIL_CHAIN3_COIL_NO2"); CCOIL[2][2] = (String)message.get("CCOIL_CHAIN3_COIL_NO3"); CCOIL[2][3] = (String)message.get("CCOIL_CHAIN3_COIL_NO4"); CCOIL[2][4] = (String)message.get("CCOIL_CHAIN3_COIL_NO5"); CCOIL[2][5] = (String)message.get("CCOIL_CHAIN3_COIL_NO6"); CCOIL[2][6] = (String)message.get("CCOIL_CHAIN3_COIL_NO7"); CCOIL[2][7] = (String)message.get("CCOIL_CHAIN3_COIL_NO8"); CCOIL[2][8] = (String)message.get("CCOIL_CHAIN3_COIL_NO9"); CCOIL[3][0] = (String)message.get("CCOIL_CHAIN4_COIL_NO1"); CCOIL[3][1] = (String)message.get("CCOIL_CHAIN4_COIL_NO2"); CCOIL[3][2] = (String)message.get("CCOIL_CHAIN4_COIL_NO3"); CCOIL[3][3] = (String)message.get("CCOIL_CHAIN4_COIL_NO4"); CCOIL[3][4] = (String)message.get("CCOIL_CHAIN4_COIL_NO5"); String MSG_DTIME = (String)message.get("MSG_DTIME"); String StepClf = null; String YardClf = null; String OldSampleNo = null; int i = 0;int j = 0; for ( i =0 ; i < 4 ; i++ ) { if (QCOIL[i] != null && !QCOIL[i].equals("")) { // PosParameter paramA = new PosParameter(); // // paramA.setWhereClauseParameter(0, QCOIL[i] ); // PosRowSet coilCommVO = this.getDao("mesdao").find("NIH020070_COIL_COM.select", paramA); //if (coilCommVO.hasNext() ) { // PosRow coilCommROW = coilCommVO.next(); // // OldSampleNo = (String)coilCommROW.getAttribute("OLD_SAMPL_NO"); //这里从界面直接传过来实际卷号,不需要使用转换 PosParameter param = new PosParameter(); StepClf = "0"+String.valueOf(i+1); param.setWhereClauseParameter(0, QCOIL[i]); param.setWhereClauseParameter(1, MSG_DTIME); param.setWhereClauseParameter(2, "MILL L1"); param.setWhereClauseParameter(3, StepClf); this.getDao("mesdao").update("NIH020070_B00.update", param); //} } if (i == 0) { //屏蔽自动制定行车命令 //SendProg_NIH050010(CCOIL[i][j],"B"); } } OldSampleNo = null; int k = 0; StepClf = null; for ( i =0 ; i < 11 ; i++ ) { if ( i == 0) { k = 2; } else if ( i == 1) { k = 4; } else if ( i == 2) { k = 4; } else if ( i == 3) { k = 4; } else if ( i == 4) { k = 3; } else if ( i == 5) { k = 4; } else if ( i == 6) { k = 4; } else if ( i == 7) { k = 2; } else if ( i == 8) { k = 2; } else if ( i == 9) { k = 2; } else if ( i == 10) { k = 2; } for ( j =0 ; j < k ; j++ ) { if (WKB[i][j] != null && !WKB[i][j].equals("")) { //从界面直接输入钢卷号,不需要通过流水号转换 // PosParameter paramB = new PosParameter(); // // paramB.setWhereClauseParameter(0, WKB[i][j] ); // PosRowSet coilCommVO = this.getDao("mesdao").find("NIH020070_COIL_COM.select", paramB); //if (coilCommVO.hasNext()) { // PosRow coilCommROW = coilCommVO.next(); // // OldSampleNo = (String)coilCommROW.getAttribute("OLD_SAMPL_NO"); PosParameter param1 = new PosParameter(); if (i > 8) { YardClf = "B"+String.valueOf(i+1); } else { YardClf = "B0"+String.valueOf(i+1); } StepClf = "0"+String.valueOf(j+1); //直接使用钢卷号 param1.setWhereClauseParameter(0, WKB[i][j]); param1.setWhereClauseParameter(1, MSG_DTIME); param1.setWhereClauseParameter(2, "MILL L1"); param1.setWhereClauseParameter(3, YardClf); param1.setWhereClauseParameter(4, StepClf); this.getDao("mesdao").update("NIH020070_WKB.update", param1); //} } } } OldSampleNo = null; k = 0; for (i = 0; i < 4; i++) { if (i == 3 ) { k = 4; } else { k = 9; } for (j = 0; j < k; j++) { if (CCOIL[i][j] != null && !CCOIL[i][j].equals("")) { PosParameter paramC = new PosParameter(); // paramC.setWhereClauseParameter(0, CCOIL[i][j] ); // PosRowSet coilCommVO = this.getDao("mesdao").find("NIH020070_COIL_COM.select", paramC); //if (coilCommVO.hasNext()) { // PosRow coilCommROW = coilCommVO.next(); // // OldSampleNo = (String)coilCommROW.getAttribute("OLD_SAMPL_NO"); PosParameter param2 = new PosParameter(); YardClf = "C0"+String.valueOf(i+1); StepClf = "0"+String.valueOf(j+1); param2.setWhereClauseParameter(0, CCOIL[i][j]); param2.setWhereClauseParameter(1, MSG_DTIME); param2.setWhereClauseParameter(2, "MILL L1"); param2.setWhereClauseParameter(3, YardClf); param2.setWhereClauseParameter(4, StepClf); this.getDao("mesdao").update("NIH020070_WKB.update", param2); //} } } } return PosBizControlConstants.SUCCESS; } public void SendProg_NIH050010(String CoilNo,String CurPos) { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); String TcId = "NIH050010"; message.setTCID(TcId); message.setObject("MSG_ID",TcId); message.setObject("COIL_NO",CoilNo); message.setObject("CURR_POS",null); context.setMessage(message); this.processComponent(PosConstants.CREATE_MESSAGE, context); String transactionCode = context.getMessage().getTC(); message.setTCID(TcId); String serviceName = TcId; String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX); context.setMessage(message); PosBizControlIF controller = PosBizProvider.getController(); controller.doSubController(context,false); } }