package xin.glue.nui.F.F01; import java.math.BigDecimal; import xin.glue.user.common.GlobalConstants; import xin.glue.user.common.LogGpError; import com.posdata.glue.PosException; import com.posdata.glue.biz.activity.PosActivity; import com.posdata.glue.biz.constants.PosBizControlConstants; import com.posdata.glue.biz.control.PosBizProvider; 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 java.lang.Long; /* Program Name SMSRhLfChange (NIF012170) * Description SMS WORK INSTRUCTION RH, LF LINE CHANGING * Write By KIM SUNG HO * Date 2008-11-10 */ public class SMSRhLfChange extends PosActivity implements GlobalConstants { public String runActivity(PosContext context) { long V_CHARGE_EDT_SEQ = 0 ; long V_RH_TEMP_TGT = 0 ; long V_LF_TEMP_TGT = 0 ; long V_CHG_SEQ = 0 ; String V_PRC_LINE = "" ; String V_PATH_PROC_CD = "" ; String V_TREAT_RT_CD = "" ; String V_LINE_PROC_CD = "" ; String V_L2_SEND = "" ; String V_CCM_CHG = "N" ; String V_TIME_RESCH = "N" ; String V_TABLE_ID = "" ; String V_TABLE_MODE = "" ; String V_ERR_DESC = "" ; String V_RTN_NAME = "" ; PosMessage message = context.getMessage(); String P_CHARGE_MANA_NO = (String)message.get("CHARGE_MANA_NO"); String P_CHK_RH = (String)message.get("CHK_RH"); String P_CHK_LF = (String)message.get("CHK_LF"); String P_CHK_CCM = (String)message.get("CHK_CCM"); String P_REG_ID = (String)message.get("REG_ID"); // try { //CHARGE_MANA_NO CHECK PosParameter param0 = new PosParameter(); param0.setWhereClauseParameter(0, P_CHARGE_MANA_NO); PosRowSet ChargeManaNoInfVO = getDao("mesdao").find("NIF012170_ChargeManaNoInf.select",param0); ChargeManaNoInfVO.reset(); if (ChargeManaNoInfVO.hasNext()) { PosRow ChargeManaNoInfRow = ChargeManaNoInfVO.next(); V_PATH_PROC_CD = (String)ChargeManaNoInfRow.getAttribute("PATH_PROC_CD"); V_LINE_PROC_CD = (String)ChargeManaNoInfRow.getAttribute("LINE_PROC_CD"); V_PRC_LINE = (String)ChargeManaNoInfRow.getAttribute("PRC_LINE"); V_L2_SEND = (String)ChargeManaNoInfRow.getAttribute("L2_SEND"); V_CHARGE_EDT_SEQ = Long.parseLong((ChargeManaNoInfRow.getAttribute("CHARGE_EDT_SEQ")==null? "0":ChargeManaNoInfRow.getAttribute("CHARGE_EDT_SEQ")).toString()); V_RH_TEMP_TGT = Long.parseLong((ChargeManaNoInfRow.getAttribute("RH_TGT_TEMP")==null? "0":ChargeManaNoInfRow.getAttribute("RH_TGT_TEMP")).toString()); V_LF_TEMP_TGT = Long.parseLong((ChargeManaNoInfRow.getAttribute("LF_TGT_TEMP")==null? "0":ChargeManaNoInfRow.getAttribute("LF_TGT_TEMP")).toString()); V_CHG_SEQ = Long.parseLong((ChargeManaNoInfRow.getAttribute("CHG_SEQ")==null? "0":ChargeManaNoInfRow.getAttribute("CHG_SEQ")).toString()); } else { //MESSAGE ERROR --> PROGRAM EXIT throw new PosException("SMSRhLfChange..NOT FOUND CHARGE_MANA_NO INFORMATION.."); } if (P_CHK_CCM != null && P_CHK_CCM.equals("Y")) { //CALL NIF012160_SMSCcmChange NIF012160_CALL(V_CHARGE_EDT_SEQ, P_REG_ID); if (V_LINE_PROC_CD.indexOf("J1") >= 0) { V_LINE_PROC_CD = V_LINE_PROC_CD.replaceAll("J1", "J2"); } else { V_LINE_PROC_CD = V_LINE_PROC_CD.replaceAll("J2", "J1"); } V_TIME_RESCH = "Y"; V_CCM_CHG = "Y"; } //RH LINE CHECK if (V_PATH_PROC_CD.indexOf("R") >= 0) { if (P_CHK_RH.equals("N")) { V_PATH_PROC_CD = V_PATH_PROC_CD.replaceAll("R", ""); V_LINE_PROC_CD = V_LINE_PROC_CD.replaceAll("R1", ""); V_RH_TEMP_TGT = 0; V_TIME_RESCH = "Y"; } } else { if (P_CHK_RH.equals("Y")) { V_PATH_PROC_CD = V_PATH_PROC_CD.replaceAll("C", "CR"); if (V_PRC_LINE.equals("1")) { V_LINE_PROC_CD = V_LINE_PROC_CD.replaceAll("C1", "C1R1"); } else { V_LINE_PROC_CD = V_LINE_PROC_CD.replaceAll("C2", "C2R1"); } V_TIME_RESCH = "Y"; } } //LF LINE CHECK if (V_PATH_PROC_CD.indexOf("L") >= 0) { if (P_CHK_LF.equals("N")) { V_PATH_PROC_CD = V_PATH_PROC_CD.replaceAll("L", ""); V_LINE_PROC_CD = V_LINE_PROC_CD.replaceAll("L1", ""); V_LF_TEMP_TGT = 0; V_TIME_RESCH = "Y"; } } else { if (P_CHK_LF.equals("Y")) { V_PATH_PROC_CD = V_PATH_PROC_CD.replaceAll("J", "LJ"); V_LINE_PROC_CD = V_LINE_PROC_CD.replaceAll("J", "L1J"); V_TIME_RESCH = "Y"; } } if (V_TIME_RESCH.equals("Y")) { //TREAT_RT_CD CHECK PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0, V_LINE_PROC_CD); PosRowSet TreatRtInfVO = getDao("mesdao").find("NIF012170_TreatRtInf.select",param1); TreatRtInfVO.reset(); if (TreatRtInfVO.hasNext()) { PosRow TreatRtRow = TreatRtInfVO.next(); V_TREAT_RT_CD = (String)TreatRtRow.getAttribute("SM_CD"); } else { //MESSAGE ERROR --> PROGRAM EXIT throw new PosException("SMSRhLfChange..NOT FOUND TreatRtInf INFORMATION.."); } //RH, LF LINE CHANGE --> TBF01_SPEC_CHARGE UPDATE PosParameter param2 = new PosParameter(); param2.setWhereClauseParameter(0, V_PATH_PROC_CD); param2.setWhereClauseParameter(1, V_LINE_PROC_CD); param2.setWhereClauseParameter(2, V_TREAT_RT_CD); param2.setWhereClauseParameter(3, String.valueOf(V_RH_TEMP_TGT)); param2.setWhereClauseParameter(4, String.valueOf(V_LF_TEMP_TGT)); param2.setWhereClauseParameter(5, String.valueOf(V_CHARGE_EDT_SEQ)); int UpdCnt1 = getDao("mesdao").update("NIF012170_ChargeProcLineUpd.update",param2); if (UpdCnt1 == 0) { V_TABLE_ID = "TBF01_SPEC_CHARGE"; V_TABLE_MODE = "U"; V_ERR_DESC = "TBF01_SPEC_CHARGE UPDATE COUNT IS ZERO"; V_RTN_NAME = "SMSRhLfChange TBF01_SPEC_CHARGE UPDATE1 " + String.valueOf(V_CHARGE_EDT_SEQ); LogGpError.logMessageToDB("SMSRhLfChange", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME); throw new PosException(V_RTN_NAME); } //CALL NIF012180_SMSSchTme NIF012180_CALL(V_PRC_LINE, V_L2_SEND, P_REG_ID); //SMS WORK RE-INSTRUCTION if (V_L2_SEND.equals("Y")) { //TBG06_L2_CHARGE_INS INSERT 出钢指示 SEND_CLF = 'U' PosParameter param4 = new PosParameter(); param4.setValueParamter(0, V_PRC_LINE); param4.setValueParamter(1, V_PRC_LINE); param4.setValueParamter(2, String.valueOf(V_CHARGE_EDT_SEQ)); int InsCnt1 = getDao("mesdao").insert("NIF012170_L2Charge.insert",param4); if (InsCnt1 == 0) { V_TABLE_ID = "TBG06_L2_CHARGE_INS"; V_TABLE_MODE = "I"; V_ERR_DESC = "TBG06_L2_CHARGE_INS UPDATE COUNT IS ZERO"; V_RTN_NAME = "SMSRhLfChange TBG06_L2_CHARGE_INS INSERTE1 " + String.valueOf(V_CHARGE_EDT_SEQ); LogGpError.logMessageToDB("SMSRhLfChange", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME); throw new PosException(V_RTN_NAME); } if (V_CCM_CHG.equals("Y")) { //TBG06_L2_CCM_INS INSERT 连铸指示 SEND_CLF = 'U' PosParameter param5 = new PosParameter(); param5.setValueParamter(0, V_PRC_LINE); param5.setValueParamter(1, V_PRC_LINE); param5.setValueParamter(2, String.valueOf(V_CHARGE_EDT_SEQ)); int InsCnt2 = getDao("mesdao").insert("NIF012170_L2Ccm.insert",param5); if (InsCnt2 == 0) { V_TABLE_ID = "TBG06_L2_CCM_INS"; V_TABLE_MODE = "I"; V_ERR_DESC = "TBG06_L2_CCM_INS UPDATE COUNT IS ZERO"; V_RTN_NAME = "SMSRhLfChange TBG06_L2_CCM_INS INSERTE2 " + String.valueOf(V_CHARGE_EDT_SEQ); LogGpError.logMessageToDB("SMSRhLfChange", V_TABLE_ID, V_TABLE_MODE, V_ERR_DESC, V_RTN_NAME); throw new PosException(V_RTN_NAME); } }// V_CCM_CHG.equals("Y") END //------------------------------------------------------------------------------------------------ //LEVEL2 JOB SCHEDULE CALL }// V_L2_SEND.equals("Y") END }// V_TIME_RESCH.equals("Y") END // } // catch (PosException ex) // { // context.put(SERVICE_ERR_MSG, ex.getMessage()); // throw ex; // } // catch (Throwable t) // { // context.put(SERVICE_ERR_MSG, t.getMessage()); // throw new PosException(t.getMessage(), t); // } return PosBizControlConstants.SUCCESS; } public PosContext NIF012160_CALL(long V_CHARGE_EDT_SEQ, String V_REG_ID) { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); //SMSCcmChange String TcId = "NIF012160"; message.setTCID(TcId); message.setObject("MSG_ID", TcId); message.setObject("CHARGE_EDT_SEQ", new BigDecimal(V_CHARGE_EDT_SEQ)); message.setObject("REG_ID", V_REG_ID); context.setMessage(message); message.setTCID(TcId); String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX); PosBizProvider.getController().doSubController(context, false); String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG"); if (SERVICE_ERR_MSG != null) { throw new PosException(SERVICE_ERR_MSG); } return context; } public PosContext NIF012180_CALL(String V_PRC_LINE, String V_L2_SEND, String V_REG_ID) { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); //SMSSchTme String TcId = "NIF012180"; message.setTCID(TcId); message.setObject("MSG_ID", TcId); message.setObject("PRC_LINE", V_PRC_LINE); message.setObject("L2_SEND", V_L2_SEND); message.setObject("CHARGE_MANA_NO", ""); message.setObject("REG_ID", V_REG_ID); context.setMessage(message); message.setTCID(TcId); String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, TcId + SERVICE_POSTFIX); PosBizProvider.getController().doSubController(context, false); String SERVICE_ERR_MSG = (String) context.get("SERVICE_ERR_MSG"); if (SERVICE_ERR_MSG != null) { throw new PosException(SERVICE_ERR_MSG); } return context; } }