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; /** * CAS * * @author * @date 2008-9-1 * */ public class PosSaveCasResult extends PosActivity { public String runActivity(PosContext context) { String[] rowStutsFlag = (String[]) context.get("rowStutsFlag");// // PosGenericDao dao = this.getDao("mesdao");// /* * * */ if (rowStutsFlag != null && rowStutsFlag.length > 0) { // String sql = "SELECT CHARGE_NO FROM TBG02_CAS_RESULT WHERE CHARGE_NO = ?"; String[] CHARGE_NO = (String[]) context.get("CHARGE_NO"); String[] PLAN_CHARGE_NO = (String[]) context.get("PLAN_CHARGE_NO"); PosParameter posparam = new PosParameter(); posparam.setWhereClauseParameter(0, CHARGE_NO[0]); PosRowSet rowset = getDao("mesdao").findByQueryStatement(sql,posparam); int count = rowset.count();// PosParameter param = new PosParameter(); String[] XIN_DATE = (String[]) context.get("XIN_DATE");// String[] CAS_NO = (String[]) context.get("CAS_NO");// String[] WKSHIFT = (String[]) context.get("WKSHIFT");// String[] WKGROUP = (String[]) context.get("WKGROUP");// String[] EMP_ID = (String[]) context.get("EMP_ID");// String[] ARRIV_WGT = (String[]) context.get("ARRIV_WGT");// String[] CAS_TREAT_WGT = (String[]) context.get("CAS_TREAT_WGT");// String[] TREAT_BEF_O2_WGT = (String[]) context .get("TREAT_BEF_O2_WGT");// String[] TREAT_AFT_O2_WGT = (String[]) context .get("TREAT_AFT_O2_WGT");// String[] AR_GAS_USE_WGT = (String[]) context.get("AR_GAS_USE_WGT");// 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 (count == 0) { param.setValueParamter(0, CHARGE_NO[0]); param.setValueParamter(1, XIN_DATE[0]); param.setValueParamter(2, CAS_NO[0]); param.setValueParamter(3, WKSHIFT[0]); param.setValueParamter(4, WKGROUP[0]); param.setValueParamter(5, EMP_ID[0]); param.setValueParamter(6, ARRIV_WGT[0]); param.setValueParamter(7, CAS_TREAT_WGT[0]); param.setValueParamter(8, TREAT_BEF_O2_WGT[0]); param.setValueParamter(9, TREAT_AFT_O2_WGT[0]); param.setValueParamter(10, AR_GAS_USE_WGT[0]); param.setValueParamter(11, PLAN_CHARGE_NO[0]); getDao("mesdao").insert("UIG020030_01.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")))) { //PosParameter param5 = new PosParameter(); //String sProgCd = "JCF"; //param5.setValueParamter(0, sProgCd); //param5.setValueParamter(1, "B"); //param5.setValueParamter(2, PlanChNo); PosParameter paramB = new PosParameter(); paramB.setValueParamter(0, "B"); paramB.setValueParamter(1, PlanChNo); this.getDao("mesdao").update("NIG020200_SPEC_PROG_02.update",paramB); this.getDao("mesdao").update("NIG020610_SPEC_CHARGE_IDX.update",paramB); if(STATUS_CD == null||(STATUS_CD != null&& STATUS_CD.equals("A"))){ PosParameter param6 = new PosParameter(); param6.setValueParamter(0, "B"); param6.setValueParamter(1, PlanChNo); this.getDao("mesdao").update("NIG020610_SPEC_SLAB.update",param6); PosParameter param7 = new PosParameter(); param7.setWhereClauseParameter(0, PlanChNo); PosRowSet specslabVo = this.getDao("mesdao").find("NIG020210_SPEC_SLAB.select", param7); while (specslabVo.hasNext()) { PosRow specslabROW = specslabVo.next(); Number SlabEdtSeq = (Number) specslabROW.getAttribute("SLAB_EDT_SEQ"); PosParameter param8 = new PosParameter(); param8.setValueParamter(0, "B"); param8.setValueParamter(1, SlabEdtSeq); this.getDao("mesdao").update("NIG020610_SPEC_SLAB_D.update", param8); } } } } else { param.setWhereClauseParameter(0, XIN_DATE[0]); param.setWhereClauseParameter(1, CAS_NO[0]); param.setWhereClauseParameter(2, WKSHIFT[0]); param.setWhereClauseParameter(3, WKGROUP[0]); param.setWhereClauseParameter(4, EMP_ID[0]); param.setWhereClauseParameter(5, ARRIV_WGT[0]); param.setWhereClauseParameter(6, CAS_TREAT_WGT[0]); param.setWhereClauseParameter(7, TREAT_BEF_O2_WGT[0]); param.setWhereClauseParameter(8, TREAT_AFT_O2_WGT[0]); param.setWhereClauseParameter(9, AR_GAS_USE_WGT[0]); param.setWhereClauseParameter(10, PLAN_CHARGE_NO[0]); param.setWhereClauseParameter(11, CHARGE_NO[0]); getDao("mesdao").update("UIG020030_01.update", param); } BigDecimal TapWgt = null; if (CAS_TREAT_WGT[0] == null || CAS_TREAT_WGT[0].equals("")) { TapWgt = new BigDecimal(0); } else { TapWgt = new BigDecimal(CAS_TREAT_WGT[0]); } saveMaster(CHARGE_NO[0], PlanChNo, TapWgt, CAS_NO[0]); } // String[] rowStuts3 = (String[]) context.get("rowStuts3"); if (rowStuts3 != null) { String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// // String[]MAINRAW_CD_DESC = // (String[])context.get("MAINRAW_CD_DESC");// String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT");// String[] CHARGE_NO = (String[]) context.get("CHARGE_NO");// for (int i = 0; i < rowStuts3.length; i++) { // PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0, CHARGE_NO[0]); param1.setWhereClauseParameter(1, MAINRAW_CD[i]); PosRowSet scrapVo = this.getDao("mesdao").find( "NIG020430_02.select", param1); if (scrapVo.hasNext()) { PosParameter param2 = new PosParameter(); param2.setValueParamter(0, MAINRAW_WGT[i]); param2.setValueParamter(1, CHARGE_NO[0]); param2.setValueParamter(2, MAINRAW_CD[i]); this.getDao("mesdao").update("NIG020430_01.update", param2); } else { PosParameter param2 = new PosParameter(); param2.setValueParamter(0, CHARGE_NO[0]); param2.setValueParamter(1, MAINRAW_CD[i]); param2.setValueParamter(2, MAINRAW_WGT[i]); this.getDao("mesdao").update("NIG020430_01.insert", param2); } } } // String[] rowStuts4 = (String[]) context.get("rowStuts4"); if (rowStuts4 != null) { // String[] MAINRAW_CD = (String[]) context.get("MAINRAW_CD");// // String[]MAINRAW_CD_DESC = // (String[])context.get("MAINRAW_CD_DESC"); String[] MAINRAW_WGT = (String[]) context.get("MAINRAW_WGT"); String[] CHARGE_NO = (String[]) context.get("CHARGE_NO"); for (int i = 0; i < rowStuts4.length; i++) { // PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0, CHARGE_NO[0]); param1.setWhereClauseParameter(1, MAINRAW_CD[i]); PosRowSet scrapVo = this.getDao("mesdao").find( "NIG020430_02.select", param1); if (scrapVo.hasNext()) { PosParameter param2 = new PosParameter(); param2.setValueParamter(0, MAINRAW_WGT[i]); param2.setValueParamter(1, CHARGE_NO[0]); param2.setValueParamter(2, MAINRAW_CD[i]); this.getDao("mesdao").update("NIG020430_01.update", param2); } else { PosParameter param2 = new PosParameter(); param2.setValueParamter(0, CHARGE_NO[0]); param2.setValueParamter(1, MAINRAW_CD[i]); param2.setValueParamter(2, MAINRAW_WGT[i]); this.getDao("mesdao").update("NIG020430_01.insert", param2); } } } return PosBizControlConstants.SUCCESS; } public void saveMaster(String ChargeNo, String PlanChNo, BigDecimal wgt, String cas_no) { 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 CurrProg = null; String BefProg = null; String ChargeStat = null; Number TapWgt = null; if (chComVo.hasNext()) { PosRow chComROW = chComVo.next(); CurrProg = (String) chComROW.getAttribute("CUR_PROG_CD"); BefProg = (String) chComROW.getAttribute("BEF_PROG_CD"); ChargeStat = (String) chComROW.getAttribute("CHARGE_STAT"); TapWgt = (Number) chComROW.getAttribute("BOF_TAPPING_WGT"); if (ChargeStat != null && ChargeStat.equals("2")) { if (CurrProg == null || !(CurrProg.equals("JLF") || CurrProg.equals("JRF") || CurrProg.equals("JJB"))) { if (CurrProg == null) { BefProg = "JBB"; } else { BefProg = CurrProg; } CurrProg = "JCF"; } PosParameter param9 = new PosParameter(); param9.setValueParamter(0, CurrProg); param9.setValueParamter(1, "UIG020030"); param9.setValueParamter(2, BefProg); param9.setValueParamter(3, TapWgt); param9.setValueParamter(4, wgt); param9.setValueParamter(5, cas_no); param9.setValueParamter(6, ChargeNo); this.getDao("mesdao").update("UIG020030_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, "JCF"); param10.setValueParamter(11, "UIG020030"); param10.setValueParamter(12, null); param10.setValueParamter(13, wgt); param10.setValueParamter(14, cas_no); 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", "JBF"); message.setObject("PROG_CD", "JCF"); 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; } }