| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266 |
- package xin.glue.nui.H.H02;
- import java.math.BigDecimal;
- import java.sql.CallableStatement;
- import java.sql.SQLException;
- import xin.glue.ui.common.PosDateFormat;
- import xin.glue.ui.common.ProduceFactory;
- 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;
- public class XinSaveSlabReject extends PosActivity
- {
- public String runActivity(PosContext context)
- {
- logger.logInfo("XinSaveSlabReject START " );
-
-
- PosMessage message = context.getMessage();
-
- String MSG_COIL_NO = (String)message.get("COIL_NO");
- String MSG_SLAB_NO = (String)message.get("SLAB_NO");
- //这里下面没有用到,接口表中也没有 TL
- //String MSG_PLAN_SLAB_NO = (String)message.get("PLAN_SLAB_NO");
- //删除区分
- String MSG_MISSNO_CLF = (String)message.get("MISSNO_CLF");
- //删除原因代码
- String MSG_MISSNO_CAUSE_CD = (String)message.get("MISSNO_CAUSE_CD");
- //删除时间
- String MSG_MISSNO_OCR_DTIME = (String)message.get("MISSNO_OCR_DTIME");
- //处理人
- String MSG_MISSNO_EMP_ID = (String)message.get("MISSNO_EMP_ID");
- //轧制计划号
- String ROLL_UNIT_NO = (String)message.get("ROLL_UNIT_NO");
-
- PosDateFormat dateFormat = new PosDateFormat();
- String sShift = dateFormat.getShiftT(MSG_MISSNO_OCR_DTIME);
-
- logger.logInfo("XinSaveSlabReject sShift:"+sShift );
-
- PosParameter param0 = new PosParameter();
- param0.setWhereClauseParameter(0,MSG_SLAB_NO );
- param0.setWhereClauseParameter(1,MSG_COIL_NO );
- PosRowSet rejVo = getDao("mesdao").find("NIH020030_01.select", param0);
-
- PosParameter param1 = new PosParameter();
- if(rejVo.hasNext())
- {
- //这里参数不够 ROLL_UNIT_NO、SLAB_NO
- //这里的作用应该是通过报文自动收一次,如果没有收成功的情况下再通过界面手工录入
- param1.setWhereClauseParameter(0, ROLL_UNIT_NO);
- param1.setWhereClauseParameter(1, MSG_MISSNO_CLF);
- param1.setWhereClauseParameter(2, MSG_MISSNO_CAUSE_CD);
- param1.setWhereClauseParameter(3, MSG_MISSNO_OCR_DTIME);
- param1.setWhereClauseParameter(4, MSG_SLAB_NO);
-
- this.getDao("mesdao").update("NIH020030_REJ.update", param1);
- }
- else
- {
- param1.setValueParamter(0, MSG_SLAB_NO);
- param1.setValueParamter(1, MSG_COIL_NO);
- param1.setValueParamter(2, ROLL_UNIT_NO);
- param1.setValueParamter(3, MSG_MISSNO_CLF);
- param1.setValueParamter(4, MSG_MISSNO_CAUSE_CD);
- param1.setValueParamter(5, MSG_MISSNO_OCR_DTIME);
- //删除作业班次
- param1.setValueParamter(6, sShift);
- //删除作业人
- param1.setValueParamter(7, MSG_MISSNO_EMP_ID);
-
- this.getDao("mesdao").insert("NIH020030_REJ.insert", param1);
- }
-
- //如果出现多次吊销的情况,只在第一次的时候给予处理
- PosParameter param9 = new PosParameter();
- String sql9 = "select RHF_STAT from TBH02_REHEATFUR where slab_no = ? and coil_no = ? ";
- param9.setWhereClauseParameter(0, MSG_SLAB_NO);
- param9.setWhereClauseParameter(1, MSG_COIL_NO);
- //这里做为是否调用品质的标志
- String RHF_STAT = null;
- PosRowSet rowset9 = getDao("mesdao").findByQueryStatement(sql9, param9);
- if(rowset9.hasNext()){
- PosRow row9 = rowset9.next();
- RHF_STAT = (String) row9.getAttribute("RHF_STAT");
- logger.logInfo("XinSaveSlabReject---> 加热炉吊销的状态:"+RHF_STAT);
- }
-
- PosParameter param2 = new PosParameter();
- param2.setWhereClauseParameter(0, "2");
- param2.setWhereClauseParameter(1,MSG_MISSNO_CLF);
- param2.setWhereClauseParameter(2,MSG_MISSNO_CAUSE_CD);
- param2.setWhereClauseParameter(3,MSG_MISSNO_OCR_DTIME);
- param2.setWhereClauseParameter(4,MSG_MISSNO_EMP_ID);
- param2.setWhereClauseParameter(5,MSG_SLAB_NO);
- //改变板坯公共表中的板坯状态信息
- getDao("mesdao").update("UIH020020_04.update", param2);
-
- PosParameter param4 = new PosParameter();
- param4.setWhereClauseParameter(0,"3");
- param4.setWhereClauseParameter(1,MSG_SLAB_NO);
- param4.setWhereClauseParameter(2,MSG_COIL_NO);
- //这个在UIH020020中,修改的是板坯缺号状态信息。这里为了回送板坯已板坯号和钢卷号做为联合主键
- getDao("mesdao").update("UIH020020_07.update", param4);
-
- //调用存货异动点存储过程
- //ProduceFactory PD= new ProduceFactory();
- //PD.ErpDataCover("HSLAB", MSG_SLAB_NO,"11AZ","0","O","热轧加热炉","加回轧回");
- // TBH02_COIL_COMM UPDATE
-
- PosParameter param8 = new PosParameter();
- param8.setWhereClauseParameter(0, "");
- param8.setWhereClauseParameter(1,"S");
- param8.setWhereClauseParameter(2,MSG_MISSNO_CAUSE_CD);
- param8.setWhereClauseParameter(3,MSG_MISSNO_OCR_DTIME);
- param8.setWhereClauseParameter(4, MSG_COIL_NO); //20210817此处二级传送过来的是真实卷号不是流水号
- //改变板坯公共表中的板坯状态信息
- //getDao("mesdao").update("NIH020030_COIL.update", param8); 20210817不能使用此SQL,因为二级给的是真实卷号OLD_SAMPL_NO而不是流水号
- getDao("mesdao").update("NIH020030_RealCOIL.update", param8);//NIH020030_RealCOIL.update
-
-
- // 由计划修改,SendProg_NIF024060
- // PosParameter param3 = new PosParameter();
- // param3.setWhereClauseParameter(0, MSG_SLAB_NO );
- // param3.setWhereClauseParameter(1, MSG_COIL_NO );
- // PosRowSet specMillVo = getDao("mesdao").find("NIH020020_SPEC_MILL.select", param3);
- // if (specMillVo.hasNext()) {
- // PosRow specMillROW = specMillVo.next();
- // Number SLAB_EDT_SEQ = (Number)specMillROW.getAttribute("SLAB_EDT_SEQ");
- //
- // PosParameter param5 = new PosParameter();
- // param5.setWhereClauseParameter(0, "C" );
- // param5.setWhereClauseParameter(1, MSG_SLAB_NO );
- // param5.setWhereClauseParameter(2, MSG_COIL_NO );
- // getDao("mesdao").update("NIH020020_SPEC_MILL.update", param5);
- //
- // PosParameter param6 = new PosParameter();
- // param6.setWhereClauseParameter(0, "C" );
- // param6.setWhereClauseParameter(1, SLAB_EDT_SEQ );
- // getDao("mesdao").update("NIH020020_SPEC_MILL_D.update", param6);
- //
- // PosParameter param7 = new PosParameter();
- // param7.setWhereClauseParameter(0, "C" );
- // param7.setWhereClauseParameter(1, SLAB_EDT_SEQ );
- // getDao("mesdao").update("NIH020020_MILL_IDX.update", param7);
- //
- //
- // }
-
- //这里必须先调用求出状态,不然状态始终为3
- if(!RHF_STAT.equals("3")){
-
- //调用存货异动点存储过程
- ProduceFactory PD= new ProduceFactory();
- PD.ErpDataCover("HSLAB", MSG_SLAB_NO,"11AZ","0","O","热轧加热炉slab","加回轧回");
-
- //Mill schedule cancel request
- SendProg_NIF024060( MSG_SLAB_NO);
-
- //调用品质存储过程
- logger.logInfo("XinSaveSlabReject---> NIB027010 TC sql call" );
-
- CallableStatement PlRtn = getDao("mesdao").getCallableStatement("NIH020020_NIB027010");
- logger.logInfo("XinSaveSlabReject---> NIB027010 TC try" );
-
- try {
- if(PlRtn != null) {
- PlRtn.setString(1,MSG_COIL_NO);
- //新增加一个字段,为了废弃的时候使用
- PlRtn.setString(2,"S");
- PlRtn.registerOutParameter(3, java.sql.Types.VARCHAR);
- PlRtn.registerOutParameter(4, java.sql.Types.VARCHAR);
-
- PlRtn.execute();
-
- String sRetCode = PlRtn.getString(3);
- String sRetMsg = PlRtn.getString(4);
-
- logger.logInfo("XinSaveSlabReject---> NIB027010 TC PlRtn1:["+sRetCode+"]:"+ sRetMsg);
-
-
- } else {
- logger.logInfo("XinSaveSlabReject---> NIB027010 PlRtn2:"+PlRtn );
-
- }
- } catch (SQLException e) {
-
- throw new PosException(e.getMessage());
- }finally
- {
- if (PlRtn != null)
- {
- try
- {
- PlRtn.close();
- }
- catch (SQLException e)
- {
- logger.logWarn(e.getMessage(), e);
-
- logger.logInfo("XinSaveSlabReject---> NIB027010 SQLException:"+e );
- }
- }
- }
- }else{
- //吊销过一次的板坯,不能再次调用品质和进程
- logger.logInfo("XinSaveSlabReject---> 加热炉多次吊销时不允许调用品质和进程:"+RHF_STAT);
- }
-
- return PosBizControlConstants.SUCCESS;
- }
- public void SendProg_NIF024060(String SlabNo )
- {
-
- logger.logInfo("PosSaveMissionNo SendProg_NIF024060 " );
-
- PosContext context = new PosContext();
- PosMessage message = new PosMESMessageImpl();
-
- String TcId = "NIF024060";
- message.setTCID(TcId);
- message.setObject("MSG_ID",TcId);
- message.setObject("TYPE","C");
- message.setObject("FROM",SlabNo);
- message.setObject("TO",SlabNo);
- message.setObject("REG_ID","RHF L2");
-
- context.setMessage(message);
- this.processComponent(PosConstants.CREATE_MESSAGE, context);
- String transactionCode = context.getMessage().getTC();
-
- message.setTCID(TcId);
-
- String serviceName = "NIF024060";
-
- String SERVICE_POSTFIX = "-service";
-
-
- context.put(PosBizControlConstants.SERVICE_NAME, serviceName + SERVICE_POSTFIX);
-
-
- context.setMessage(message);
-
-
- PosBizControlIF controller = PosBizProvider.getController();
-
- controller.doSubController(context,false);
-
- }
- }
|