package xin.glue.nui.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.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 xin.glue.ui.common.PosDateFormat; /* * author:wangxiaoyan * Date:08-10-28 * desc: 钢水回送实绩 */ public class XinSaveReturnCharge extends PosActivity { public String runActivity(PosContext context) { PosMessage message = context.getMessage(); String MSG_CHRGE_NO = (String)message.get("CHARGE_NO" ); String MSG_PLAN_CHARGE_NO = (String)message.get("PLAN_CHARGE_NO" ); String MSG_RTN_CHARGE_OCR_PROC = (String)message.get("RTN_CHARGE_OCR_PROC" ); String MSG_RTN_CHARGE_OCR_DTIME = (String)message.get("RTN_CHARGE_OCR_DTIME" ); BigDecimal MSG_RTN_CHARGE_WGT = (BigDecimal)message.get("RTN_CHARGE_WGT" ); String MSG_RTN_CHARGE_CAUSE_CD = (String)message.get("RTN_CHARGE_CAUSE_CD" ); logger.logInfo("XinSaveReturnCharge---> MSG_PLAN_CHARGE_NO:"+MSG_PLAN_CHARGE_NO ); PosParameter param0 = new PosParameter(); PosParameter param1 = new PosParameter(); param1.setValueParamter(0,MSG_RTN_CHARGE_OCR_DTIME ); param1.setValueParamter(1,MSG_RTN_CHARGE_CAUSE_CD ); param1.setValueParamter(2,MSG_RTN_CHARGE_WGT ); param1.setValueParamter(3,MSG_RTN_CHARGE_OCR_PROC ); param1.setValueParamter(4,MSG_CHRGE_NO ); // 修改炉次公共表 this.getDao("mesdao").update("NIG020630_CHARGE_COM.update",param1); // Product control system table update // TBF01_SPEC_CHARGE,TBF01_CHARGE_IDX,TBF01_SPEC_SLAB,TBF01_SPEC_SLAB_D // if slab cutting result is existing then there are can not that's update param0.setWhereClauseParameter(0, MSG_PLAN_CHARGE_NO); PosRowSet SpecChVo = getDao("mesdao").find("NIG020610_SLAB_SPEC.select", param0); while (SpecChVo.hasNext() ) { PosParameter paramA = new PosParameter(); paramA.setWhereClauseParameter(0, MSG_PLAN_CHARGE_NO); PosRowSet SlabVo = getDao("mesdao").find("NIG020610_SLAB_COMM.select", paramA); if (!SlabVo.hasNext()) { PosRow SpecChROW = SpecChVo.next(); Number nSlabEdtSeq = (Number)SpecChROW.getAttribute("SLAB_EDT_SEQ"); String SlabManaNo = (String)SpecChROW.getAttribute("SLAB_MANA_NO"); PosParameter param2 = new PosParameter(); param2.setValueParamter(0, "C" ); param2.setValueParamter(1, SlabManaNo.substring(0,9) ); this.getDao("mesdao").update("NIG020610_SPEC_SLAB.update", param2); PosParameter param3 = new PosParameter(); param3.setValueParamter(0, "C" ); param3.setValueParamter(1, nSlabEdtSeq ); this.getDao("mesdao").update("NIG020610_SPEC_SLAB_D.update", param3); } } String CurProgCd = null; String BefProgCd = null; PosParameter param6 = new PosParameter(); param6.setWhereClauseParameter(0, MSG_CHRGE_NO); PosRowSet chComVo = getDao("mesdao").find("NIG020630_CHARGE_COM.select", param6); if (chComVo.hasNext()) { PosRow chComROW = chComVo.next(); CurProgCd = (String)chComROW.getAttribute("CUR_PROG_CD"); BefProgCd = (String)chComROW.getAttribute("BEF_PROG_CD"); } PosParameter param4 = new PosParameter(); param4.setValueParamter(0, "C"); param4.setValueParamter(1, CurProgCd ); param4.setValueParamter(2, MSG_PLAN_CHARGE_NO ); this.getDao("mesdao").update("NIG020610_SPEC_CHARGE.update", param4); PosParameter param5 = new PosParameter(); param5.setValueParamter(0, "C" ); param5.setValueParamter(1, MSG_PLAN_CHARGE_NO ); this.getDao("mesdao").update("NIG020610_SPEC_CHARGE_IDX.update", param5); PosParameter param7= new PosParameter(); param7.setValueParamter(0, MSG_CHRGE_NO ); this.getDao("mesdao").update("NIG020630_SLAB_COMM.update", param7); // Progress system sub-service call SendProg_NIE012070( MSG_PLAN_CHARGE_NO,null,null,CurProgCd,BefProgCd,MSG_RTN_CHARGE_WGT ); SendProg_NIE012080(); return PosBizControlConstants.SUCCESS; } public PosContext SendProg_NIE012070(String MatNo,String sOrdNo,String sOrdSeq,String sCurProg,String sBefProg,BigDecimal wgt ) { logger.logInfo("XinSaveCcmResult SendProg_NIE012070 " ); 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",sBefProg); message.setObject("PROG_CD",sCurProg); message.setObject("MAT_TYPE","CH"); message.setObject("MAT_NO",MatNo); message.setObject("WGT",wgt); message.setObject("PGMID","XinSaveReturnCharge"); message.setObject("REG_ID","LEVEL2"); context.setMessage(message); this.processComponent(PosConstants.CREATE_MESSAGE, context); String transactionCode = context.getMessage().getTC(); logger.logInfo("XinSaveCcmResult---> 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.logInfo("XinSaveCcmResult---> NIE012070 TC SendProgress end" ); return null; } public PosContext SendProg_NIE012080() { logger.logInfo("XinSaveCcmResult 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.logInfo("XinSaveChargeProc---> 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.logInfo("XinSaveChargeProc---> NIE012080 TC SendProgress end" ); return null; } }