package xin.glue.ui.G.G02; 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.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; /* * 连铸实绩的插入与保存 * @author 王小炎 * @data 2008.08.20 */ public class PosSaveCCMResult extends PosActivity { public String runActivity(PosContext context) { // 从前台获取参数 String[] status = (String[])context.get("status"); String[] CHARGE_NO = (String[])context.get("CHARGE_NO"); String[] PLAN_CHARGE_NO = (String[])context.get("PLAN_CHARGE_NO"); String[] CAST_END_YN = (String[])context.get("CAST_END_YN"); String[] XIN_DATE = (String[])context.get("XIN_DATE"); String[] CC_DEVNO = (String[])context.get("CC_DEVNO"); String[] WKSHIFT = (String[])context.get("WKSHIFT"); String[] WKGROUP = (String[])context.get("WKGROUP"); String[] REG_ID = (String[])context.get("REG_ID"); String[] STLMELT_WGT = (String[])context.get("STLMELT_WGT"); String[] CC_END_STLMELT_USE_WGT = (String[])context.get("CC_END_STLMELT_USE_WGT"); String[] REM_WGT_IN_TD = (String[])context.get("REM_WGT_IN_TD"); String[] CC_YIELD = (String[])context.get("CC_YIELD"); String[] STLMELT_TEMP = (String[])context.get("STLMELT_TEMP"); String PlanChNo = null; if (PLAN_CHARGE_NO[0] == null || PLAN_CHARGE_NO[0].equals("")) { PlanChNo = '3'+CHARGE_NO[0].substring(1,10); } else { PlanChNo = PLAN_CHARGE_NO[0]; } PosParameter paramA = new PosParameter(); paramA.setWhereClauseParameter(0, PlanChNo); PosRowSet L2Send = this.getDao("mesdao").find("UIG020020_L2_SEND_CHARGE.select", paramA); if(!L2Send.hasNext()){ return PosBizControlConstants.SUCCESS; } if(status.length>0) { String sql = "SELECT CHARGE_NO FROM TBG02_CC_RESULT WHERE CHARGE_NO = ?"; PosParameter posparam = new PosParameter(); posparam.setWhereClauseParameter(0, CHARGE_NO[0]); PosRowSet rowset = getDao("mesdao").findByQueryStatement(sql, posparam); PosParameter param = new PosParameter(); if(rowset.hasNext()){ // 设置sql语句参数值 param.setWhereClauseParameter(0, CAST_END_YN[0]); param.setWhereClauseParameter(1, XIN_DATE[0]); param.setWhereClauseParameter(2, CC_DEVNO[0]); param.setWhereClauseParameter(3, WKSHIFT[0]); param.setWhereClauseParameter(4, WKGROUP[0]); param.setWhereClauseParameter(5, REG_ID[0]); param.setWhereClauseParameter(6, STLMELT_WGT[0]); param.setWhereClauseParameter(7, CC_END_STLMELT_USE_WGT[0]); param.setWhereClauseParameter(8, REM_WGT_IN_TD[0]); param.setWhereClauseParameter(9, CC_YIELD[0]); param.setWhereClauseParameter(10, STLMELT_TEMP[0]); param.setWhereClauseParameter(11, CHARGE_NO[0]); getDao("mesdao").update("UIG020070_02.update", param); }else{ param.setValueParamter(0, CAST_END_YN[0]); param.setValueParamter(1, XIN_DATE[0]); param.setValueParamter(2, CC_DEVNO[0]); param.setValueParamter(3, WKSHIFT[0]); param.setValueParamter(4, WKGROUP[0]); param.setValueParamter(5, REG_ID[0]); param.setValueParamter(6, STLMELT_WGT[0]); param.setValueParamter(7, CC_END_STLMELT_USE_WGT[0]); param.setValueParamter(8, REM_WGT_IN_TD[0]); param.setValueParamter(9, CC_YIELD[0]); param.setValueParamter(10, STLMELT_TEMP[0]); param.setValueParamter(11, CHARGE_NO[0]); param.setValueParamter(12, PLAN_CHARGE_NO[0]); getDao("mesdao").insert("UIG020070_02.insert", param); String STATUS_CD = null; paramA = new PosParameter(); paramA.setWhereClauseParameter(0, PlanChNo); PosRowSet specChVo = this.getDao("mesdao").find("NIG020200_SPEC_CHARGE.select", paramA); if (specChVo.hasNext()) { PosRow specChROW = specChVo.next(); STATUS_CD = (String) specChROW.getAttribute("STATUS_CD"); } if ( STATUS_CD == null || (STATUS_CD != null && (STATUS_CD.equals("A") || STATUS_CD.equals("B")))) { //param = new PosParameter(); //String sProgCd = "JJB"; //param.setValueParamter(0, sProgCd); //param.setValueParamter(1, "B"); //param.setValueParamter(2, PlanChNo); param = new PosParameter(); param.setValueParamter(0, "B" ); param.setValueParamter(1, PlanChNo ); this.getDao("mesdao").update("NIG020200_SPEC_PROG_02.update", param); this.getDao("mesdao").update("NIG020200_SPEC_CHARGE_IDX.update", param); if(STATUS_CD == null||(STATUS_CD != null&& STATUS_CD.equals("A"))){ this.getDao("mesdao").update("NIG020610_SPEC_SLAB.update", param); param = new PosParameter(); param.setWhereClauseParameter(0,PlanChNo); PosRowSet specslabVo = this.getDao("mesdao").find("NIG020210_SPEC_SLAB.select", param); while(specslabVo.hasNext()) { PosRow specslabROW = specslabVo.next(); Number SlabEdtSeq = (Number)specslabROW.getAttribute("SLAB_EDT_SEQ"); param = new PosParameter(); param.setValueParamter(0, "B" ); param.setValueParamter(1, SlabEdtSeq ); this.getDao("mesdao").update("NIG020610_SPEC_SLAB_D.update", param); } } } } BigDecimal TapWgt = null; if(STLMELT_WGT[0] == null || STLMELT_WGT[0].equals("")) { TapWgt = new BigDecimal(0); } else { TapWgt = new BigDecimal(STLMELT_WGT[0]) ; } saveMaster(CHARGE_NO[0],PlanChNo,TapWgt,CC_DEVNO[0]); } return PosBizControlConstants.SUCCESS; } public void saveMaster(String ChargeNo,String PlanChNo,BigDecimal wgt,String ccmNo ) { String PRODNM_CD = null; String STL_GRD = null; String LINE_PROC_CD = null; String HCR_CLF = null; String SPEC_ABBSYM = null; String CAST_MANA_NO = null; Number CAST_CHARGE_SEQ = null; String CHARGE_MANA_NO = null; Number CAST_EDT_CHARGE_CNT = null; PosParameter paramA = new PosParameter(); paramA.setWhereClauseParameter(0, PlanChNo); PosRowSet specChVo = this.getDao("mesdao").find("NIG020200_SPEC_CHARGE.select", paramA); if (specChVo.hasNext()) { PosRow specChROW = specChVo.next(); PRODNM_CD = (String)specChROW.getAttribute("PRODNM_CD"); STL_GRD = (String)specChROW.getAttribute("STL_GRD"); LINE_PROC_CD = (String)specChROW.getAttribute("LINE_PROC_CD"); HCR_CLF = (String)specChROW.getAttribute("HCR_CLF"); SPEC_ABBSYM = (String)specChROW.getAttribute("SPEC_ABBSYM"); CAST_MANA_NO = (String)specChROW.getAttribute("CAST_MANA_NO"); CAST_CHARGE_SEQ = (Number)specChROW.getAttribute("CAST_CHARGE_SEQ"); CHARGE_MANA_NO = (String)specChROW.getAttribute("CHARGE_MANA_NO"); CAST_EDT_CHARGE_CNT = (Number)specChROW.getAttribute("CAST_EDT_CHARGE_CNT"); } PosParameter param8 = new PosParameter(); param8.setWhereClauseParameter(0, ChargeNo); PosRowSet chComVo = this.getDao("mesdao").find("UIG020020_CH_COM.select", param8); String BefProg = null; String CurrProg = null; Number TapWgt = null; if (chComVo.hasNext()) { PosRow chComROW = chComVo.next(); BefProg = (String)chComROW.getAttribute("CUR_PROG_CD"); TapWgt = (Number)chComROW.getAttribute("BOF_TAPPING_WGT"); CurrProg = "JJB"; PosParameter param9 = new PosParameter(); param9.setValueParamter(0, CurrProg ); param9.setValueParamter(1, "UIG020070"); param9.setValueParamter(2, TapWgt); param9.setValueParamter(3, wgt); param9.setValueParamter(4, ccmNo); param9.setValueParamter(5, ChargeNo ); this.getDao("mesdao").update("UIG020070_CH_COM.update", param9); } else { PosParameter param10 = new PosParameter(); param10.setValueParamter(0, ChargeNo ); param10.setValueParamter(1, CHARGE_MANA_NO ); param10.setValueParamter(2, STL_GRD ); param10.setValueParamter(3, PRODNM_CD ); param10.setValueParamter(4, LINE_PROC_CD ); param10.setValueParamter(5, HCR_CLF ); param10.setValueParamter(6, SPEC_ABBSYM ); param10.setValueParamter(7, CAST_MANA_NO ); param10.setValueParamter(8, CAST_CHARGE_SEQ); param10.setValueParamter(9, CAST_EDT_CHARGE_CNT); param10.setValueParamter(10, CurrProg); param10.setValueParamter(11, "UIG020070"); param10.setValueParamter(12, wgt); param10.setValueParamter(13, wgt); param10.setValueParamter(14, ccmNo); this.getDao("mesdao").update("UIG020020_CH_COM.insert", param10); PosParameter param9 = new PosParameter(); param9.setWhereClauseParameter(0, ChargeNo); PosRowSet specSlabVo = this.getDao("mesdao").find("NIG020200_SPEC_SLAB.select", param9); while(specSlabVo.hasNext()) { PosRow SlabSpecROW = specSlabVo.next(); Number sSlabEdtSeq= (Number)SlabSpecROW.getAttribute("SLAB_EDT_SEQ"); String sPlanSlabNo= (String)SlabSpecROW.getAttribute("SLAB_MANA_NO"); String sStlGrd = (String)SlabSpecROW.getAttribute("STL_GRD"); Number sSlabThk = (Number)SlabSpecROW.getAttribute("SLAB_THK"); Number sSlabWth = (Number)SlabSpecROW.getAttribute("SLAB_WTH"); Number sSlabLen = (Number)SlabSpecROW.getAttribute("SLAB_LEN"); Number sSlabWgt = (Number)SlabSpecROW.getAttribute("SLAB_WGT"); String sProdNmCd = (String)SlabSpecROW.getAttribute("PRODNM_CD"); String sOrdFl = (String)SlabSpecROW.getAttribute("ORD_FL"); String sOrdNo = (String)SlabSpecROW.getAttribute("ORD_NO"); String sOrdSeq = (String)SlabSpecROW.getAttribute("ORD_SEQ"); String sHcrClf = (String)SlabSpecROW.getAttribute("HCR_CLF"); String sSpecAbbsym= (String)SlabSpecROW.getAttribute("SPEC_ABBSYM"); Number ORD_THK = (Number)SlabSpecROW.getAttribute("ORD_THK"); Number ORD_WTH = (Number)SlabSpecROW.getAttribute("ORD_WTH"); Number ORD_LEN = (Number)SlabSpecROW.getAttribute("ORD_LEN"); Number ORD_WGT = (Number)SlabSpecROW.getAttribute("ORD_WGT"); Number COIL_INDIA = (Number)SlabSpecROW.getAttribute("COIL_INDIA"); Number COIL_OUTDIA= (Number)SlabSpecROW.getAttribute("COIL_OUTDIA"); String sSlabSeq = sPlanSlabNo.substring(10,13); String sSlabNo = ChargeNo+sSlabSeq; PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0, sSlabNo); PosRowSet CreatSlabVo = getDao("mesdao").find("NIG020200_CREATE_SLAB.select", param1); if (!CreatSlabVo.hasNext() ) { PosParameter param2 = new PosParameter(); param2.setValueParamter(0, sSlabNo ); param2.setValueParamter(1, sPlanSlabNo ); param2.setValueParamter(2, sStlGrd ); param2.setValueParamter(3, sSlabThk ); param2.setValueParamter(4, sSlabWth ); param2.setValueParamter(5, sSlabLen ); param2.setValueParamter(6, sSlabWgt ); param2.setValueParamter(7, sProdNmCd ); param2.setValueParamter(8, sOrdFl ); param2.setValueParamter(9, sOrdNo ); param2.setValueParamter(10, sOrdSeq ); param2.setValueParamter(11, sHcrClf ); param2.setValueParamter(12, sSpecAbbsym ); param2.setValueParamter(13, sOrdFl ); param2.setValueParamter(14, sOrdNo ); param2.setValueParamter(15, sOrdSeq ); param2.setValueParamter(16, ORD_THK ); param2.setValueParamter(17, ORD_WTH ); param2.setValueParamter(18, ORD_LEN ); param2.setValueParamter(19, COIL_INDIA ); param2.setValueParamter(20, COIL_OUTDIA ); param2.setValueParamter(21, ORD_WGT ); getDao("mesdao").update("NIG020200_CREATE_SLAB.insert",param2); PosParameter param3 = new PosParameter(); param3.setWhereClauseParameter(0, sSlabEdtSeq); PosRowSet CreatSlabDVo = getDao("mesdao").find("NIG020200_SPEC_SLAB_D.select", param3); while( CreatSlabDVo.hasNext()) { PosRow CreatSlabDROW = CreatSlabDVo.next(); String S_SLAB_CUT_SEQ = (String)CreatSlabDROW.getAttribute("SLAB_CUT_SEQ"); Number S_SLAB_THK = (Number)CreatSlabDROW.getAttribute("SLAB_THK"); Number S_SLAB_WTH = (Number)CreatSlabDROW.getAttribute("SLAB_WTH"); Number S_SLAB_LEN = (Number)CreatSlabDROW.getAttribute("SLAB_LEN"); //Number S_SLAB_WGT = (Number)CreatSlabDROW.getAttribute("SLAB_WGT"); Number S_ORD_THK = (Number)CreatSlabDROW.getAttribute("ORD_THK"); Number S_ORD_WTH = (Number)CreatSlabDROW.getAttribute("ORD_WTH"); Number S_ORD_LEN = (Number)CreatSlabDROW.getAttribute("ORD_LEN"); Number S_ORD_WGT = (Number)CreatSlabDROW.getAttribute("ORD_WGT"); Number S_COIL_INDIA = (Number)CreatSlabDROW.getAttribute("COIL_INDIA"); Number S_COIL_OUTDIA = (Number)CreatSlabDROW.getAttribute("COIL_OUTDIA"); String S_ORD_NO = (String)CreatSlabDROW.getAttribute("ORD_NO"); String S_ORD_SEQ = (String)CreatSlabDROW.getAttribute("ORD_SEQ"); String S_ORD_FL = (String)CreatSlabDROW.getAttribute("ORD_FL"); PosParameter param5 = new PosParameter(); param5.setWhereClauseParameter(0, sSlabNo); PosRowSet SalbDVo = getDao("mesdao").find("NIG020200_CREATE_SLAB_D.select", param5); if (!SalbDVo.hasNext()) { PosParameter param4 = new PosParameter(); param4.setValueParamter(0, sSlabNo ); param4.setValueParamter(1, S_SLAB_CUT_SEQ ); param4.setValueParamter(2, S_SLAB_THK ); param4.setValueParamter(3, S_SLAB_WTH ); param4.setValueParamter(4, S_SLAB_LEN ); param4.setValueParamter(5, S_ORD_THK ); param4.setValueParamter(6, S_ORD_WTH ); param4.setValueParamter(7, S_ORD_LEN ); param4.setValueParamter(8, S_ORD_WGT ); param4.setValueParamter(9, S_COIL_INDIA ); param4.setValueParamter(10, S_COIL_OUTDIA ); param4.setValueParamter(11, S_ORD_NO ); param4.setValueParamter(12, S_ORD_SEQ ); param4.setValueParamter(13, S_ORD_FL ); getDao("mesdao").update("NIG020200_CREATE_SLAB_D.insert",param4); } } } } } SendProg_NIE012070(PlanChNo,BefProg,wgt); SendProg_NIE012080(); } public PosContext SendProg_NIE012070(String ChargeNo,String BefProg,BigDecimal wgt ) { // BigDecimal wgt = new BigDecimal(); PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); String TcId = "NIE012070"; message.setTCID(TcId); message.setObject("MSG_ID",TcId); message.setObject("BEF_ORD_NO",null); message.setObject("BEF_ORD_SEQ",null); message.setObject("ORD_NO",null); message.setObject("ORD_SEQ",null); message.setObject("BEF_PROG_CD",BefProg); message.setObject("PROG_CD","JJB"); message.setObject("MAT_TYPE","CH"); message.setObject("MAT_NO",ChargeNo); message.setObject("WGT", wgt ); message.setObject("PGMID","UIG020030"); message.setObject("REG_ID","UIG020030"); message.setTCID(TcId); context.setMessage(message); String serviceName = "NIE012070"; String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX); PosBizControlIF controller = PosBizProvider.getController(); controller.doSubController(context,false); logger.logInfo("XinSaveBofResult---> NIE012070 TC SendProgress end" ); return null; } public PosContext SendProg_NIE012080() { logger.logInfo("XinSaveBofResult SendProg_NIE012080 " ); PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); String TcId = "NIE012080"; message.setTCID(TcId); message.setObject("MSG_ID",TcId); message.setObject("AA",null); message.setTCID(TcId); context.setMessage(message); // this.processComponent(PosConstants.CREATE_MESSAGE, context); // String transactionCode = context.getMessage().getTC(); String serviceName = "NIE012080"; String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX); // context.setMessage(message); PosBizControlIF controller = PosBizProvider.getController(); controller.doSubController(context,false); logger.logInfo("XinSaveBofResult---> NIE012080 TC SendProgress end" ); return null; } }