| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350 |
- package xin.glue.ui.G.G02;
- import java.math.BigDecimal;
- import java.sql.CallableStatement;
- import java.sql.SQLException;
- import java.sql.Types;
- 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.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.PosGenericDao;
- 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: 钢水回送实绩
- * DESC:090708 ADD 返送炉次计划自动下发 by sjw
- */
- public class XinSaveReturnCharge extends PosActivity
- {
- public String runActivity(PosContext context)
- {
- PosParameter param = null;
- PosRow row = null;
- PosRowSet rowset = null;
- PosGenericDao dao = getDao("mesdao");
-
- String[] MSG_CHRGE_NO = (String[])context.get("CHARGE_NO" );
- String[] MSG_PLAN_CHARGE_NO = (String[])context.get("PLAN_CHARGE_NO" );
- String[] MSG_RTN_CHARGE_OCR_PROC = (String[])context.get("RTN_CHARGE_OCR_PROC" );
- String[] MSG_RTN_CHARGE_OCR_DTIME = (String[])context.get("RTN_CHARGE_OCR_DTIME" );
- String[] MSG_RTN_CHARGE_WGT = (String[])context.get("RTN_CHARGE_WGT" );
- String[] MSG_RTN_CHARGE_CAUSE_CD = (String[])context.get("RTN_CHARGE_CAUSE_CD" );
- String P_NEW_CHARGE_MANA_NO = "";
- String P_RTN_MSG = "";
- String PGMID = "";
- BigDecimal chgWgt = new BigDecimal(MSG_RTN_CHARGE_WGT[0]);
-
- logger.logInfo("XinSaveReturnCharge---> MSG_PLAN_CHARGE_NO:"+MSG_PLAN_CHARGE_NO );
-
- param = new PosParameter();
- String getPlanChargeNo = "select plan_charge_no from tbg02_charge_comm where charge_no = ?";
- param.setWhereClauseParameter(0, MSG_CHRGE_NO[0]);
- rowset = dao.findByQueryStatement(getPlanChargeNo,param);
- if(rowset.hasNext()){
- row = rowset.next();
- MSG_PLAN_CHARGE_NO[0] = (String)row.getAttribute("PLAN_CHARGE_NO");
- }else{
- context.put("MESSAGES", " 无计划炉次号,操作失败! ");
- return PosBizControlConstants.SUCCESS;
- }
-
- /****************************炉次回送取消已编制的轧制计划*********************************************************/
- /**
- * ADD:090717
- * BY:SJW
- * DESC:如果编制了热送计划,则回送需要取消轧制计划
- */
-
- PosParameter param_hcr_mill_fl = new PosParameter();
- param_hcr_mill_fl.setWhereClauseParameter(0, MSG_CHRGE_NO[0]);
- PosRowSet mill_fl_vo = getDao("mesdao").find("NIG020630_HCR_MILL_FL.select", param_hcr_mill_fl);
- mill_fl_vo.reset();
-
- while (mill_fl_vo.hasNext() ) {
- PosRow mill_fl_row = mill_fl_vo.next();
- String lv_slab_no = (String)mill_fl_row.getAttribute("SLAB_NO");
- NIF024060_CALL(lv_slab_no,"XinSaveReturnCharge");
- }
-
- /***********************************************************************************************************/
-
- PosParameter param0 = new PosParameter();
- PosParameter param1 = new PosParameter();
-
- param1.setValueParamter(0,MSG_RTN_CHARGE_OCR_DTIME[0] );
- param1.setValueParamter(1,MSG_RTN_CHARGE_CAUSE_CD[0] );
- param1.setValueParamter(2,chgWgt );
- param1.setValueParamter(3,MSG_RTN_CHARGE_OCR_PROC[0] );
- param1.setValueParamter(4,MSG_CHRGE_NO[0] );
- // 修改炉次公共表
- 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[0]);
- PosRowSet SpecChVo = getDao("mesdao").find("NIG020610_SLAB_SPEC.select", param0);
-
- while (SpecChVo.hasNext() ) {
-
-
- PosParameter paramA = new PosParameter();
- paramA.setWhereClauseParameter(0, MSG_PLAN_CHARGE_NO[0]);
- 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[0]);
- 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[0] );
- this.getDao("mesdao").update("NIG020610_SPEC_CHARGE.update", param4);
-
- PosParameter param5 = new PosParameter();
- param5.setValueParamter(0, "C" );
- param5.setValueParamter(1, MSG_PLAN_CHARGE_NO[0] );
- this.getDao("mesdao").update("NIG020610_SPEC_CHARGE_IDX.update", param5);
-
- PosParameter param7= new PosParameter();
- param7.setValueParamter(0, MSG_CHRGE_NO[0] );
- this.getDao("mesdao").update("NIG020630_SLAB_COMM.update", param7);
-
-
- PGMID = "XinSaveReturnCharge";
- // Progress system sub-service call
- SendProg_NIE012070( MSG_PLAN_CHARGE_NO[0],null,null,CurProgCd,BefProgCd,chgWgt,PGMID );
- SendProg_NIE012080();
-
- CallableStatement cStmt = null;
- try
- {
- cStmt = this.getDao("mesdao").getCallableStatement("CALL_RTN_CHARGE_AUTO");
- cStmt.setString(1,MSG_PLAN_CHARGE_NO[0]);
- cStmt.registerOutParameter(2, Types.VARCHAR);
- cStmt.registerOutParameter(3, Types.VARCHAR);
-
- cStmt.execute();
-
- P_NEW_CHARGE_MANA_NO = cStmt.getString(2);
- P_RTN_MSG = cStmt.getString(3);
-
-
- } catch (SQLException ex)
- {
- logger.logFatal("Can not execute PL/SQL",ex);
- throw new PosException("Can not execute PL/SQL >> " + P_RTN_MSG,ex);
- } finally
- {
- try
- {
- if(cStmt != null)
- {
- cStmt.close();
- }
-
- } catch (SQLException ex)
- {
- logger.logFatal("Can not Close CallableStatement Query ID [callTest]",ex);
- }
- }
- if(P_RTN_MSG == null || "".equals(P_RTN_MSG)) {
- ;
- } else {
- throw new PosException(P_RTN_MSG);
- }
-
- PGMID = "CALL_RTN_CHARGE_AUTO";
- SendProg_NIE012070(P_NEW_CHARGE_MANA_NO,null,null,"JBA","",chgWgt,PGMID );
- SendProg_NIE012080();
-
- context.put("MESSAGES", " 操作成功! ");
- return PosBizControlConstants.SUCCESS;
- }
-
- public PosContext SendProg_NIE012070(String MatNo,String sOrdNo,String sOrdSeq,String sCurProg,String sBefProg,BigDecimal wgt ,String V_PGM_ID )
- {
-
- 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",V_PGM_ID);
- 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;
- }
-
- public PosContext NIF024060_CALL(String V_SLAB_NO, String V_REG_ID)
- {
- PosContext context = new PosContext();
- PosMessage message = new PosMESMessageImpl();
-
- String TcId = "NIF024060";
- message.setTCID(TcId);
- message.setObject("MSG_ID", TcId);
- message.setObject("TYPE", "M");
- message.setObject("FROM" , V_SLAB_NO);
- message.setObject("TO" , V_SLAB_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;
- }
- }
-
-
-
-
|