package xin.glue.ui.J.J01; 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 saveOrdNoHH extends PosActivity{ String P_RTN_MSG = ""; public String runActivity(PosContext context) { //充当物料 String[] coil_t = (String[]) context.get("R_MAT_NO"); //被替换的物料 String[] coil_f = (String[]) context.get("coil_no"); //替换人 String[] P_REG_ID = (String[]) context.get("P_REG_ID"); //是否同牌号 String[] V_SIGN_STL = (String[]) context.get("SIGN_STL"); //是否同成分 String[] V_SIGN_CHEN_FEN = (String[]) context.get("SIGN_CHEN_FEN"); //是否同材质 String[] V_SIGN_WGT = (String[]) context.get("SIGN_WGT"); //是否检查重量 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]; logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 开始"); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 coil_t "+coil_t[0]); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 coil_f "+coil_f[0]); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 P_REG_ID"+P_REG_ID[0]); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 V_SIGN_STL "+V_SIGN_STL[0]); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 V_SIGN_CHEN_FEN "+V_SIGN_CHEN_FEN[0]); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 V_SIGN_WGT "+V_SIGN_WGT[0]); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 V_SING_CAIZHI "+V_SING_CAIZHI[0]); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 传入参数 V_SIGN_QIANGZHI "+V_SIGN_QIANGZHI[0]); CallableStatement cStmt = null; cStmt = this.getDao("mesdao").getCallableStatement("NIE03_SERVEAS.MAT_REP_EACH_OTHER"); try { if(cStmt != null) { cStmt.setString(1,coil_f[0]); cStmt.setString(2,coil_t[0]); cStmt.setString(3,V_SIGN_STL[0]); cStmt.setString(4,V_SIGN_CHEN_FEN[0]); cStmt.setString(5,V_SING_CAIZHI[0]); cStmt.setString(6,V_SIGN_WGT[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); } logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 结束"); logger.logInfo("调用 NIE03_SERVEAS.MAT_REP_EACH_OTHER 返回标志P_RTN_MSG为 : "+P_RTN_MSG); //这里先调用进程,再处理相应的发货 PosParameter param = new PosParameter(); param.setWhereClauseParameter(0,coil_t[0]); PosRowSet MatVOT = getDao("mesdao").find("UIF031046_CoilInf.select",param); while(MatVOT.hasNext()) { PosRow MatInfRow = MatVOT.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 V_ORD_NO = (String)MatInfRow.getAttribute("ORD_NO") ==null ? "" :(String)MatInfRow.getAttribute("ORD_NO"); String V_ORD_SEQ = (String)MatInfRow.getAttribute("ORD_SEQ") ==null ? "" :(String)MatInfRow.getAttribute("ORD_SEQ"); 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, V_ORD_SEQ,LV_BEF_ORD_NO,LV_BEF_ORD_SEQ,LV_BEF_PROG_CD,LV_CUR_PROG_CD,"AR",P_REG_ID[0]); logger.logInfo("saveOrdNoHH 充当物料的合同号 V_ORD_NO: "+V_ORD_NO); logger.logInfo("saveOrdNoHH 充当物料的物料号 LV_MAT_NO: "+LV_MAT_NO); logger.logInfo("saveOrdNoHH 充当物料的物料重量 LV_MAT_WGT: "+LV_MAT_WGT); logger.logInfo("saveOrdNoHH 充当物料的订单号 V_ORD_SEQ: "+V_ORD_SEQ); logger.logInfo("saveOrdNoHH 充当物料的前合同号 LV_BEF_ORD_NO: "+LV_BEF_ORD_NO); logger.logInfo("saveOrdNoHH 充当物料的前进程代码 LV_BEF_PROG_CD: "+LV_BEF_PROG_CD); logger.logInfo("saveOrdNoHH 充当物料的前订单号 LV_BEF_ORD_SEQ: "+LV_BEF_ORD_SEQ); logger.logInfo("saveOrdNoHH 充当物料的进程代码 LV_CUR_PROG_CD: "+LV_CUR_PROG_CD); } PosParameter param1 = new PosParameter(); param1.setWhereClauseParameter(0,coil_f[0]); PosRowSet MatVOF = getDao("mesdao").find("UIF031046_CoilInf.select",param1); while(MatVOF.hasNext()) { PosRow MatInfRow = MatVOF.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 V_ORD_NO = (String)MatInfRow.getAttribute("ORD_NO") ==null ? "" :(String)MatInfRow.getAttribute("ORD_NO"); String V_ORD_SEQ = (String)MatInfRow.getAttribute("ORD_SEQ") ==null ? "" :(String)MatInfRow.getAttribute("ORD_SEQ"); 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, V_ORD_SEQ,LV_BEF_ORD_NO,LV_BEF_ORD_SEQ,LV_BEF_PROG_CD,LV_CUR_PROG_CD,"AR",P_REG_ID[0]); logger.logInfo("saveOrdNoHH 被替换的物料的合同号 V_ORD_NO: "+V_ORD_NO); logger.logInfo("saveOrdNoHH 被替换的物料的物料号 LV_MAT_NO: "+LV_MAT_NO); logger.logInfo("saveOrdNoHH 被替换的物料的物料重量 LV_MAT_WGT: "+LV_MAT_WGT); logger.logInfo("saveOrdNoHH 被替换的物料的订单号 V_ORD_SEQ: "+V_ORD_SEQ); logger.logInfo("saveOrdNoHH 被替换的物料的前合同号 LV_BEF_ORD_NO: "+LV_BEF_ORD_NO); logger.logInfo("saveOrdNoHH 被替换的物料的前进程代码 LV_BEF_PROG_CD: "+LV_BEF_PROG_CD); logger.logInfo("saveOrdNoHH 被替换的物料的前订单号 LV_BEF_ORD_SEQ: "+LV_BEF_ORD_SEQ); logger.logInfo("saveOrdNoHH 被替换的物料的进程代码 LV_CUR_PROG_CD: "+LV_CUR_PROG_CD); } NIE012080_CALL(); 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", "saveOrdNoHH"); 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; } }