package xin.glue.nui.E.E03; 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.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; public class OrdRepSaveZD extends PosActivity { String P_RTN_MSG = ""; String V_MAT_TYPE = ""; public String runActivity(PosContext context) { String[] P_REG_ID = (String[]) context.get("P_REG_ID"); String[] V_ORD_NO = (String[]) context.get("R_ORD_NO"); String[] V_ORD_SEQ = (String[]) context.get("R_ORD_SEQ"); String[] V_MAT_NO = (String[]) context.get("R_MAT_NO"); String[] V_SIGN_STL = (String[]) context.get("SIGN_STL"); String[] V_SIGN_CHEN_FEN = (String[]) context.get("SIGN_CHEN_FEN"); String[] V_SING_CAIZHI = (String[]) context.get("SING_CAIZHI"); String[] V_SIGN_QIANGZHI = (String[]) context.get("SIGN_QIANGZHI"); P_REG_ID[0] = (P_REG_ID[0] == null) ? "" :P_REG_ID[0]; CallableStatement cStmt = null; PosRowSet MatVO = null; cStmt = this.getDao("mesdao").getCallableStatement("callNIE03_SERVEAS"); try { if(cStmt != null) { cStmt.setString(1,V_MAT_NO[0]); cStmt.setString(2,V_ORD_NO[0]); cStmt.setString(3,V_ORD_SEQ[0]); cStmt.setString(4,V_SIGN_STL[0]); cStmt.setString(5,V_SIGN_CHEN_FEN[0]); cStmt.setString(6,V_SING_CAIZHI[0]); cStmt.setString(7,V_SIGN_QIANGZHI[0]); cStmt.setString(8,(P_REG_ID[0])); cStmt.registerOutParameter(9, Types.VARCHAR); cStmt.execute(); P_RTN_MSG = cStmt.getString(9); // NIF024050_CALL(P_TYPE,P_ST,P_EN); } } catch (SQLException e) { // e.printStackTrace(); throw new PosException(e.getMessage()); }finally { if (cStmt != null) { try { cStmt.close(); } catch (SQLException e) { logger.logWarn(e.getMessage(), e); } } } if(P_RTN_MSG == null || "".equals(P_RTN_MSG)) { ; } else { throw new PosException(P_RTN_MSG); } PosParameter param = new PosParameter(); param.setWhereClauseParameter(0,V_MAT_NO[0]); if('J' ==(V_MAT_NO[0].charAt(0))) { V_MAT_TYPE = "TM"; MatVO = getDao("mesdao").find("UIF031046_SlabInf.select",param); }else if('R' ==(V_MAT_NO[0].charAt(0))){ V_MAT_TYPE = "AR"; MatVO = getDao("mesdao").find("UIF031046_CoilInf.select",param); }else { } MatVO.reset(); while(MatVO.hasNext()) { PosRow MatInfRow = MatVO.next(); String LV_MAT_NO = (String)MatInfRow.getAttribute("MAT_NO"); long LV_MAT_WGT = Long.parseLong((MatInfRow.getAttribute("MAT_WGT")==null? "0":MatInfRow.getAttribute("MAT_WGT")).toString()); String LV_BEF_ORD_NO = (String)MatInfRow.getAttribute("ORG_ORD_NO") ==null ? "" :(String)MatInfRow.getAttribute("ORG_ORD_NO"); String LV_BEF_PROG_CD = (String)MatInfRow.getAttribute("BEF_PROG_CD" )==null ? "" :(String)MatInfRow.getAttribute("BEF_PROG_CD"); String LV_BEF_ORD_SEQ = (String)MatInfRow.getAttribute("ORG_ORD_SEQ")==null ? "" :(String)MatInfRow.getAttribute("ORG_ORD_SEQ"); String LV_CUR_PROG_CD = (String)MatInfRow.getAttribute("CUR_PROG_CD")==null ? "" :(String)MatInfRow.getAttribute("CUR_PROG_CD"); //CALL NIE012070_SaveOrdSts NIE012070_CALL(LV_MAT_NO, LV_MAT_WGT,V_ORD_NO[0], V_ORD_SEQ[0],LV_BEF_ORD_NO,LV_BEF_ORD_SEQ,LV_BEF_PROG_CD,LV_CUR_PROG_CD,V_MAT_TYPE,P_REG_ID[0]); } //SlabInfVO while END NIE012080_CALL(); //2010年5月14日,王黎修改 if(new OrdChk(V_ORD_NO[0], V_ORD_SEQ[0]).isOver()){ //throw new PosException("订单超量...OrdRepSaveZD.OrdChk.isOver..."+V_ORD_NO[0] + " - " + V_ORD_SEQ[0]); logger.logInfo("订单超量...OrdRepSaveZD.OrdChk.isOver..."+V_ORD_NO[0] + " - " + V_ORD_SEQ[0]); context.put("errorMsg", "订单超量...OrdRepSaveZD.OrdChk.isOver..."+V_ORD_NO[0] + " - " + V_ORD_SEQ[0]); return PosBizControlConstants.FAILURE; }; return PosBizControlConstants.SUCCESS; } public PosContext NIE012070_CALL( String P_MAT_NO,long V_WGT,String V_ORD_NO ,String V_ORD_SEQ,String P_BEF_ORD_NO,String P_BEF_ORD_SEQ,String P_BEF_PROG_CD,String P_CUR_PROG_CD,String P_MAT_TYPE,String V_REG_ID) { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); //SaveOrdSts String TcId = "NIE012070"; message.setTCID(TcId); message.setObject("MSG_ID", TcId); message.setObject("BEF_ORD_NO", P_BEF_ORD_NO); message.setObject("BEF_ORD_SEQ", P_BEF_ORD_SEQ); message.setObject("ORD_NO", V_ORD_NO ); message.setObject("ORD_SEQ", V_ORD_SEQ); message.setObject("BEF_PROG_CD", P_BEF_PROG_CD); message.setObject("PROG_CD", P_CUR_PROG_CD); message.setObject("MAT_TYPE", P_MAT_TYPE); message.setObject("MAT_NO", P_MAT_NO); message.setObject("WGT", new BigDecimal(V_WGT)); message.setObject("PGMID", "OrdRepSaveZD"); 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; } public PosContext NIE012080_CALL() { PosContext context = new PosContext(); PosMessage message = new PosMESMessageImpl(); //OrdStsMain String TcId = "NIE012080"; message.setTCID(TcId); message.setObject("MSG_ID", TcId); message.setObject("AA", ""); 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; } }