package xin.glue.nui.G.G02; import java.math.BigDecimal; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import xin.glue.ui.common.PosDateFormat; 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; /* * author:wangxiaoyan * Date:08-10-28 * desc: */ public class XinSaveCasResult extends PosActivity { public String runActivity(PosContext context) { PosMessage message = context.getMessage(); String RsvDate = (String) message.get("DATE"); // String msgId = (String) message.get("MSG_ID"); // String date = (String) message.get("DATE"); // String seqNo = (String) message.get("SEQ_NO"); // String reserve = (String) message.get("RESERVE"); String chargeNo = (String) message.get("CHARGE_NO"); String planChargeNo = (String) message.get("PLAN_CHARGE_NO"); // String stlGrd = (String) message.get("STL_GRD"); // String specAbbsym = (String) message.get("SPEC_ABBSYM"); String casNo = (String) message.get("CAS_NO"); BigDecimal casTreatCnt = (BigDecimal) message.get("CAS_TREAT_CNT"); BigDecimal arrvWgt = (BigDecimal) message.get("ARRV_WGT"); BigDecimal casTreatWgt = (BigDecimal) message.get("CAS_TREAT_WGT"); BigDecimal slagThk = (BigDecimal) message.get("SLAG_THK"); String casArrvDtime = (String) message.get("CAS_ARRV_DTIME"); String casStaDtime = (String) message.get("CAS_STA_DTIME"); String casEndDtime = (String) message.get("CAS_END_DTIME"); String casDepDtime = (String) message.get("CAS_DEP_DTIME"); BigDecimal casTreatHour = (BigDecimal) message.get("CAS_TREAT_HOUR"); BigDecimal arGasBlowHour = (BigDecimal) message.get("AR_GAS_BLOW_HOUR"); BigDecimal casArrvTemp = (BigDecimal) message.get("CAS_ARRV_TEMP"); BigDecimal casStaTemp = (BigDecimal) message.get("CAS_STA_TEMP"); BigDecimal casEndTemp = (BigDecimal) message.get("CAS_END_TEMP"); BigDecimal casDepTemp = (BigDecimal) message.get("CAS_DEP_TEMP"); BigDecimal treatBefO2Wgt = (BigDecimal) message.get("TREAT_BEF_O2_WGT"); BigDecimal treatAftO2Wgt = (BigDecimal) message.get("TREAT_AFT_O2_WGT"); BigDecimal arGasuseWgt = (BigDecimal) message.get("AR_GAS_USE_WGT"); int chLth = chargeNo.trim().length(); if (chLth < 10 ) { logger.logError("XinSaveCasResult CHARGE_NO ERROR !!!!-->"+chargeNo ); return PosBizControlConstants.SUCCESS; } String sShift = null; if (RsvDate == null || RsvDate.equals("")) { DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); RsvDate = formatter.format(new Date()); } sShift = PosDateFormat.getShift(RsvDate); PosParameter paramA = new PosParameter(); paramA.setWhereClauseParameter(0, RsvDate.substring(0, 6)); paramA.setWhereClauseParameter(1, RsvDate.substring(6, 8)); paramA.setWhereClauseParameter(2, sShift); paramA.setWhereClauseParameter(3, "S"); PosRowSet groupVO = this.getDao("mesdao").find( "NIG020210_SHIFT.select", paramA); String sGroup = null; if (groupVO.hasNext()) { PosRow groupROW = groupVO.next(); sGroup = (String) groupROW.getAttribute("GR_GROUP_CD"); } PosParameter param0 = new PosParameter(); PosParameter param1 = new PosParameter(); // PosParameter param2 = new PosParameter(); param0.setWhereClauseParameter(0, chargeNo); PosRowSet rowset0 = this.getDao("mesdao").find("NIG020410_01.select",param0); if (rowset0.hasNext()) { param1.setValueParamter(0, planChargeNo); param1.setValueParamter(1, casNo); param1.setValueParamter(2, casTreatCnt); param1.setValueParamter(3, arrvWgt); param1.setValueParamter(4, casTreatWgt); param1.setValueParamter(5, slagThk); param1.setValueParamter(6, casArrvDtime); param1.setValueParamter(7, casStaDtime); param1.setValueParamter(8, casEndDtime); param1.setValueParamter(9, casDepDtime); param1.setValueParamter(10, casTreatHour); param1.setValueParamter(11, arGasBlowHour); param1.setValueParamter(12, casArrvTemp); param1.setValueParamter(13, casStaTemp); param1.setValueParamter(14, casEndTemp); param1.setValueParamter(15, casDepTemp); param1.setValueParamter(16, treatBefO2Wgt); param1.setValueParamter(17, treatAftO2Wgt); param1.setValueParamter(18, arGasuseWgt); param1.setValueParamter(19, sShift); param1.setValueParamter(20, sGroup); param1.setValueParamter(21, RsvDate.substring(0, 8)); param1.setValueParamter(22, chargeNo); this.getDao("mesdao").update("NIG020410_01.update", param1); } else { param1.setValueParamter(0, chargeNo); param1.setValueParamter(1, planChargeNo); param1.setValueParamter(2, casNo); param1.setValueParamter(3, casTreatCnt); param1.setValueParamter(4, arrvWgt); param1.setValueParamter(5, casTreatWgt); param1.setValueParamter(6, slagThk); param1.setValueParamter(7, casArrvDtime); param1.setValueParamter(8, casStaDtime); param1.setValueParamter(9, casEndDtime); param1.setValueParamter(10, casDepDtime); param1.setValueParamter(11, casTreatHour); param1.setValueParamter(12, arGasBlowHour); param1.setValueParamter(13, casArrvTemp); param1.setValueParamter(14, casStaTemp); param1.setValueParamter(15, casEndTemp); param1.setValueParamter(16, casDepTemp); param1.setValueParamter(17, treatBefO2Wgt); param1.setValueParamter(18, treatAftO2Wgt); param1.setValueParamter(19, arGasuseWgt); param1.setValueParamter(20, sShift); param1.setValueParamter(21, sGroup); param1.setValueParamter(22, RsvDate.substring(0, 8)); this.getDao("mesdao").insert("NIG020410_01.insert", param1); String BefProg = "JBF"; String ChargeStat = null; String PlanhargeNo = null; PosParameter paramZ = new PosParameter(); paramZ.setWhereClauseParameter(0, chargeNo); PosRowSet chargeVO = this.getDao("mesdao").find("NIG020210_03.select", paramZ); if (chargeVO.hasNext()) { PosRow chargeROW = chargeVO.next(); ChargeStat = (String) chargeROW.getAttribute("CHARGE_STAT"); PlanhargeNo = (String)chargeROW.getAttribute("PLAN_CHARGE_NO"); } if (ChargeStat != null && ChargeStat.equals("2") && PlanhargeNo != null) { PosParameter param5 = new PosParameter(); String sProgCd = "JCF"; param5.setValueParamter(0, sProgCd); param5.setValueParamter(1, "B"); param5.setValueParamter(2, PlanhargeNo); this.getDao("mesdao").update("NIG020200_SPEC_PROG.update",param5); SendProg_NIE012070(planChargeNo, BefProg, casTreatWgt); SendProg_NIE012080(); } } return PosBizControlConstants.SUCCESS; } public PosContext SendProg_NIE012070(String ChargeNo, String BefProg, BigDecimal wgt) { logger.logDebug("XinSaveCasResult SendProg_NIE012070 wgt:" + wgt); 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", "JCF"); message.setObject("MAT_TYPE", "CH"); message.setObject("MAT_NO", ChargeNo); message.setObject("WGT", wgt); message.setObject("PGMID", "XinSaveCasResult"); message.setObject("REG_ID", "LEVEL2"); context.setMessage(message); this.processComponent(PosConstants.CREATE_MESSAGE, context); String transactionCode = context.getMessage().getTC(); logger.logDebug("XinSaveCasResult---> transactionCode:(" + transactionCode + ")"); message.setTCID(TcId); String serviceName = "NIE012070"; String SERVICE_POSTFIX = "-service"; context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX); context.setMessage(message); PosBizControlIF controller = PosBizProvider.getController(); controller.doSubController(context, false); logger.logDebug("XinSaveCasResult---> NIE012070 TC SendProgress end"); return null; } public PosContext SendProg_NIE012080() { logger.logDebug("XinSaveCasResult 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); context.setMessage(message); this.processComponent(PosConstants.CREATE_MESSAGE, context); String transactionCode = context.getMessage().getTC(); logger.logDebug("XinSaveCasResult---> transactionCode:(" + transactionCode + ")"); message.setTCID(TcId); 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.logDebug("XinSaveCasResult---> NIE012080 TC SendProgress end"); return null; } }