package xin.glue.ui.H.H02; import java.math.BigDecimal; import java.sql.CallableStatement; import java.sql.SQLException; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; import xin.glue.nui.G.G02.SmsProgTcSend; 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.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 com.posdata.glue.util.log.PosLog; import com.posdata.glue.util.log.PosLogFactory; public class PosSaveMillResult extends PosActivity { static PosLog logger = PosLogFactory.getLogger(PosSaveMillResult.class); public String runActivity(PosContext context) { logger.logInfo(" UIH020030 PosSaveMillResult save "); //从页面获取的数据 String[] MSG_SLAB_NO = (String[])context.get("SLAB_NO"); String[] MSG_COIL_NO = (String[])context.get("COIL_NO"); //统计日 String[] MSG_XIN_DATE = (String[])context.get("XIN_DATE"); String[] MSG_WKSHIFT = (String[])context.get("WKSHIFT"); String[] MSG_WKGROUP = (String[])context.get("WKGROUP"); String[] MSG_WK_EMP_NO = (String[])context.get("WK_EMP_NO"); String[] MSG_COIL_THK = (String[])context.get("COIL_THK"); String[] MSG_COIL_WTH = (String[])context.get("COIL_WTH"); String[] MSG_COIL_LTH = (String[])context.get("COIL_LEN"); //实际重量 String[] MSG_ACT_WGT = (String[])context.get("ACT_WGT"); String[] MSG_COIL_OUTDIA = (String[])context.get("COIL_OUTDIA"); String[] MSG_COIL_INDIA = (String[])context.get("COIL_INDIA"); String[] MSG_DC_NO = (String[])context.get("DC_NO"); String[] MSG_DC_ON_DTIME = (String[])context.get("DC_ON_DTIME"); String[] MSG_DC_OFF_DTIME = (String[])context.get("DC_OFF_DTIME"); //区分代码 String[] MSG_MISSNO_CLF_CD = (String[])context.get("MISSNO_CLF_CD"); //理由代码 String[] MSG_MISSNO_CAUSE_CD = (String[])context.get("MISSNO_CAUSE_CD"); //区域代码 String[] MISSNO_CAUSE_QY = (String[])context.get("MISSNO_CAUSE_QY"); //发生时间 String[] MSG_MISSNO_DTIME = (String[])context.get("MISSNO_DTIME"); //废弃宽度 String[] MISSNO_BAR_THK = (String[])context.get("MISSNO_BAR_THK"); //废弃厚度 String[] MISSNO_BAR_WTH = (String[])context.get("MISSNO_BAR_WTH"); //废弃重量 String[] MISSNO_BAR_WGT = (String[])context.get("MISSNO_BAR_WGT"); //登录人 String[] REG_ID = (String[])context.get("REG_ID"); //登录人 String[] CHKUPD = (String[])context.get("CHKUPD"); //这里加入加热炉入炉状态控制,只有为2的状态才可以继续进行操作 PosParameter paramw = new PosParameter(); paramw.setWhereClauseParameter(0, MSG_SLAB_NO[0]); paramw.setWhereClauseParameter(1, MSG_COIL_NO[0]); PosRowSet slabVow = getDao("mesdao").find("UIH020030_03.select", paramw); String RHF_STAT = null; //捕获数据格式异常,不抛出写入日志中。避免内存溢出 try{ //这里的状态用于表示,钢卷如果吊销或者加回的情况下。不能录入轧制实际 if(slabVow.hasNext()){ PosRow Vow = slabVow.next(); RHF_STAT = (String) Vow.getAttribute("RHF_STAT"); } //这里只有出过炉的和轧过的才可以进行轧制实际操作 if(RHF_STAT.equals("2") || RHF_STAT.equals("4")||RHF_STAT.equals("3")){ if (MSG_DC_OFF_DTIME[0] == null || MSG_DC_OFF_DTIME[0].equals("")) { DateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss"); MSG_DC_OFF_DTIME[0] = formatter.format(new Date()); } String sqlc = "SELECT COIL_NO,nvl(WGT_TIME,to_char(sysdate,'yyyymmddhh24miss')) WGT_TIME FROM TBH02_COIL_COMM WHERE COIL_NO = ?"; String timec; Date datec = new Date(); DateFormat sdfc = new SimpleDateFormat("yyyyMMddHHmmss"); //这里取出钢卷状态,如果为1的情况说明是出过炉的可以调用轧制和废弃品质和进程。如果为2是轧制过的,只能调用废弃的品质和进程.如果是为3是轧过或者做过其它处理就不调用品质和进程 PosParameter paramc = new PosParameter(); paramc.setWhereClauseParameter(0,MSG_COIL_NO[0] ); PosRowSet CoilVo1 = getDao("mesdao").findByQueryStatement(sqlc, paramc); /* if (CoilVo1.hasNext()) { PosRow CoilROW = CoilVo1.next(); //根据钢卷接收的二级电文时间与保存时间对比,超过24小时不允许修改 //如果前端传入参数CHKUPD为1,表示特殊权限运行修改 20190518 wl timec = (String)CoilROW.getAttribute("WGT_TIME"); Date d = sdfc.parse(timec); // 将日期和时间的字符串表示形式转换为其等效的 DateTime。 int hours = (int) ((datec.getTime() - d.getTime()) / (1000 * 60 * 60)); if(hours>24) { if(CHKUPD==null||!"1".equals(CHKUPD[0])) { String vtemp="TST"; context.put("rs", vtemp); return PosBizControlConstants.SUCCESS; } } }*/ //20220112王小云要求去掉限制 Number CalWgt = null; String sql0 = "SELECT SLAB_WGT,CUR_PROG_CD,SLAB_THK,SLAB_WTH,SLAB_LEN from TBG02_SLAB_COMM WHERE SLAB_NO = ?"; PosParameter param4 = new PosParameter(); param4.setWhereClauseParameter(0,MSG_SLAB_NO[0]); PosRowSet slabVo = getDao("mesdao").findByQueryStatement(sql0, param4); Number SlabWgt = null; //所有的单位都为MM,具体的转换等业务人员确定 Number SlabThk = null; Number SlabWth = null; Number SlabLen = null; if (slabVo.hasNext() ) { PosRow slabROW = slabVo.next(); //这里没有 CHRGING_BEF_WGT 用 SLAB_WGT 板坯重量 SlabWgt = (Number)slabROW.getAttribute("SLAB_WGT"); SlabThk = (Number)slabROW.getAttribute("SLAB_THK"); SlabWth = (Number)slabROW.getAttribute("SLAB_WTH"); SlabLen = (Number)slabROW.getAttribute("SLAB_LEN"); //现在进程状态,后面没有用到 //SlabProgCd = (String)slabROW.getAttribute("CUR_PROG_CD"); } if (SlabWgt != null ) { //这里的计算重量需要业务人员确认 CalWgt = SlabWgt; } String CoilLth =null; if (MSG_COIL_LTH[0] == null || MSG_COIL_LTH[0].equals("")) { if(MSG_COIL_WTH[0] != null || MSG_COIL_THK[0] != null ) { String sqlCal = "SELECT TO_CHAR(ROUND((?*?*?)/(?*?),1)) COIL_LTH from dual "; PosParameter paramu = new PosParameter(); paramu.setWhereClauseParameter(0,SlabThk); paramu.setWhereClauseParameter(1,SlabWth); paramu.setWhereClauseParameter(2,SlabLen); paramu.setWhereClauseParameter(3,MSG_COIL_THK[0]); paramu.setWhereClauseParameter(4,MSG_COIL_WTH[0]); PosRowSet calVo = getDao("mesdao").findByQueryStatement(sqlCal, paramu); if (calVo.hasNext()) { PosRow calROW = calVo.next(); CoilLth = (String)calROW.getAttribute("COIL_LTH"); logger.logInfo("PosSaveMillResult 如果钢卷长度的计算公式:slab_thk*slab_wth*slab_len/coil_thk*coil_wth 单位为mm"); logger.logInfo("PosSaveMillResult 如果钢卷长度为空的情况下,长度为 :"+CoilLth); } } if (CoilLth != null ) { MSG_COIL_LTH[0] = CoilLth; } } String sql = "SELECT * from TBH02_MILL_RESULT WHERE COIL_NO = ?"; PosParameter param0 = new PosParameter(); param0.setWhereClauseParameter(0,MSG_COIL_NO[0] ); PosRowSet millVo = getDao("mesdao").findByQueryStatement(sql, param0); PosParameter param1 = new PosParameter(); PosParameter param2 = new PosParameter(); PosParameter param22 = new PosParameter(); PosParameter param3 = new PosParameter(); PosParameter param11 = new PosParameter(); PosParameter param12 = new PosParameter(); PosParameter param33 = new PosParameter(); //查询钢卷轧制实际中是否存在值 if(millVo.hasNext()){ param1.setValueParamter(0,MSG_XIN_DATE[0] ); param1.setValueParamter(1,MSG_WKSHIFT[0] ); param1.setValueParamter(2,MSG_WKGROUP[0] ); param1.setValueParamter(3,MSG_WK_EMP_NO[0] ); param1.setValueParamter(4,MSG_COIL_THK[0] ); param1.setValueParamter(5,MSG_COIL_WTH[0] ); param1.setValueParamter(6,MSG_COIL_LTH[0] ); param1.setValueParamter(7,MSG_ACT_WGT[0] ); param1.setValueParamter(8,MSG_COIL_OUTDIA[0] ); param1.setValueParamter(9,MSG_COIL_INDIA[0] ); param1.setValueParamter(10,MSG_DC_NO[0] ); param1.setValueParamter(11,MSG_DC_ON_DTIME[0] ); param1.setValueParamter(12,MSG_DC_OFF_DTIME[0] ); param1.setValueParamter(13,MSG_MISSNO_CLF_CD[0] ); param1.setValueParamter(14,MSG_MISSNO_CAUSE_CD[0] ); param1.setValueParamter(15,MSG_MISSNO_DTIME[0] ); param1.setValueParamter(16,MSG_SLAB_NO[0] ); param1.setValueParamter(17,MISSNO_BAR_THK[0] ); param1.setValueParamter(18,MISSNO_BAR_WTH[0] ); param1.setValueParamter(19,MISSNO_BAR_WGT[0] ); param1.setValueParamter(20,REG_ID[0] ); param1.setValueParamter(21,MISSNO_CAUSE_QY[0] ); param1.setValueParamter(22,MSG_COIL_NO[0] ); getDao("mesdao").update("UIH020030_MILL.update", param1); }else{ param1.setValueParamter(0,MSG_COIL_NO[0] ); param1.setValueParamter(1,MSG_SLAB_NO[0] ); param1.setValueParamter(2,MSG_XIN_DATE[0] ); param1.setValueParamter(3,MSG_WKSHIFT[0] ); param1.setValueParamter(4,MSG_WKGROUP[0] ); param1.setValueParamter(5,MSG_WK_EMP_NO[0] ); param1.setValueParamter(6,MSG_COIL_THK[0] ); param1.setValueParamter(7,MSG_COIL_WTH[0] ); param1.setValueParamter(8,MSG_COIL_LTH[0] ); param1.setValueParamter(9,MSG_ACT_WGT[0] ); param1.setValueParamter(10,MSG_COIL_OUTDIA[0] ); param1.setValueParamter(11,MSG_COIL_INDIA[0] ); param1.setValueParamter(12,MSG_DC_NO[0] ); param1.setValueParamter(13,MSG_DC_ON_DTIME[0] ); param1.setValueParamter(14,MSG_DC_OFF_DTIME[0] ); param1.setValueParamter(15,MSG_MISSNO_CLF_CD[0] ); param1.setValueParamter(16,MSG_MISSNO_CAUSE_CD[0] ); param1.setValueParamter(17,MSG_MISSNO_DTIME[0] ); param1.setValueParamter(18,MISSNO_BAR_THK[0] ); param1.setValueParamter(19,MISSNO_BAR_WTH[0] ); param1.setValueParamter(20,MISSNO_BAR_WGT[0] ); param1.setValueParamter(21,REG_ID[0] ); param1.setValueParamter(22,MISSNO_CAUSE_QY[0] ); getDao("mesdao").insert("UIH020030_MILL.insert",param1); } //用来更新钢卷公共表的 String SPEC_STL_GRD = null; String XIN_SPEC_STL_GRD = null; String SPEC_SPEC_ABBSYM = null; String SPEC_DEVLMT_DTIME = null; String SPEC_ORD_NO = null; String SPEC_ORD_SEQ = null; String SPEC_ORD_USE_CD = null; String ROUTE = null; BigDecimal SLAB_EDT_SEQ = null; String SPEC_ORDCUST_CD = null; String SPEC_DEST_CD = null; String SPEC_SPM_YN = null; String SpmYn = null; String SPEC_PATH_MILL_CD = null; String SPEC_PACK_METHOD = null; Number SPEC_THK = null; Number SPEC_WTH = null; Number SPEC_LEN = null; Number SPEC_WGT = null; Number SPEC_WGT_MIN = null; Number SPEC_WGT_MAX = null; Number SPEC_INDIA = null; Number SPEC_OUTDIA = null; //产品代码 String SPEC_PRODNM_CD = null; //板坯重量 //Number slab_wgt = null; //用来更新钢卷详细表的 String COIL_CUT_SEQ = null; Number SPEC_ORD_THK = null; Number SPEC_ORD_WTH = null; Number SPEC_ORD_LEN = null; Number SPEC_ORD_WGT = null; Number SPEC_ORD_WGT_MIN = null; Number SPEC_ORD_WGT_MAX = null; Number SPEC_ORD_INDIA = null; Number SPEC_ORD_OUTDIA = null; String SPEC_ORD_FL = null; //取轧制计划中的相关信息,放入钢卷公共表中 PosRowSet SpecMillVo = (PosRowSet) context.get("SpecMillResult"); SpecMillVo.reset(); if (SpecMillVo.hasNext() ) { PosRow SpecMillROW = SpecMillVo.next(); //牌号 SPEC_STL_GRD = (String)SpecMillROW.getAttribute("STL_GRD"); XIN_SPEC_STL_GRD = (String)SpecMillROW.getAttribute("SPEC_STL_GRD"); //标准号 SPEC_SPEC_ABBSYM = (String)SpecMillROW.getAttribute("SPEC_ABBSYM"); //交货期 SPEC_DEVLMT_DTIME = (String)SpecMillROW.getAttribute("DELV_REQ_DATE"); //合同号 SPEC_ORD_NO = (String)SpecMillROW.getAttribute("ORD_NO"); //订单号 SPEC_ORD_SEQ = (String)SpecMillROW.getAttribute("ORD_SEQ"); //订单用途代码 SPEC_ORD_USE_CD = (String)SpecMillROW.getAttribute("ORD_USEAGE_CD"); //定单去向 ROUTE = (String)SpecMillROW.getAttribute("ROUTE"); //板坯编制号 SLAB_EDT_SEQ = (BigDecimal)SpecMillROW.getAttribute("SLAB_EDT_SEQ"); //客户代码 SPEC_ORDCUST_CD = (String)SpecMillROW.getAttribute("ORD_CUST_CD"); SPEC_DEST_CD = (String)SpecMillROW.getAttribute("DEST_CD"); //平整分卷指定判断 SPEC_SPM_YN = (String)SpecMillROW.getAttribute("SPM_PROC_YN"); //改变平整分卷标志 if (SPEC_SPM_YN != null && SPEC_SPM_YN.equals("Y")) { SpmYn = "1"; } else { SpmYn = ""; } SPEC_PATH_MILL_CD = (String)SpecMillROW.getAttribute("PATH_MILL_CD"); SPEC_PACK_METHOD = (String)SpecMillROW.getAttribute("PACK_METHOD"); SPEC_THK = (Number)SpecMillROW.getAttribute("ORD_THK"); SPEC_WTH = (Number)SpecMillROW.getAttribute("ORD_WTH"); SPEC_LEN = (Number)SpecMillROW.getAttribute("SPEC_LEN"); SPEC_WGT = (Number)SpecMillROW.getAttribute("ORD_WGT"); SPEC_WGT_MIN = (Number)SpecMillROW.getAttribute("ORD_WGT_MIN"); SPEC_WGT_MAX = (Number)SpecMillROW.getAttribute("ORD_WGT_MAX"); SPEC_INDIA = (Number)SpecMillROW.getAttribute("ORD_INDIA"); SPEC_OUTDIA = (Number)SpecMillROW.getAttribute("ORD_OUTDIA"); } String StatCd = null; String ProgCd = null; if (MSG_MISSNO_CLF_CD[0] != null && !MSG_MISSNO_CLF_CD[0].equals("")) { //钢卷状态,这里只要存在废弃原因代码钢卷的状态就为3.不论中厚板还是废钢所有的废弃代码都为C StatCd = "3"; } else { StatCd = "2"; } // 从TBG02_SLAB_COMM中取得 产品代码 需要插入到TBH02_COIL_COMM表中 param11.setWhereClauseParameter(0, MSG_SLAB_NO[0]); PosRowSet rowset1 = this.getDao("mesdao").find("NIH020050_03.select",param11); if(rowset1.hasNext()){ PosRow row1 = rowset1.next(); SPEC_PRODNM_CD = (String)row1.getAttribute("PRODNM_CD"); //产品代码 //与后面冲突,所以屏蔽掉 TL 20100507 //slab_wgt = (Number)row1.getAttribute("SLAB_WGT"); //板坯重量 } String Prog_Cd = null; String COIL_STAT = null; /* String time = null; Date date = new Date(); DateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss"); */ String sql2 = "SELECT COIL_NO,CUR_PROG_CD,COIL_STAT,nvl(WGT_TIME,to_char(sysdate,'yyyymmddhh24miss')) WGT_TIME FROM TBH02_COIL_COMM WHERE COIL_NO = ?"; //这里取出钢卷状态,如果为1的情况说明是出过炉的可以调用轧制和废弃品质和进程。如果为2是轧制过的,只能调用废弃的品质和进程.如果是为3是轧过或者做过其它处理就不调用品质和进程 param2.setWhereClauseParameter(0,MSG_COIL_NO[0] ); PosRowSet CoilVo = getDao("mesdao").findByQueryStatement(sql2, param2); if (CoilVo.hasNext()) { PosRow CoilROW = CoilVo.next(); ProgCd = (String)CoilROW.getAttribute("CUR_PROG_CD"); COIL_STAT = (String)CoilROW.getAttribute("COIL_STAT"); if (ProgCd == null || ProgCd.equals("") || ProgCd.equals("SED")|| ProgCd.equals("SRC")){//20220112王小云要求加入余材 if (ProgCd!= null && !ProgCd.equals("SED")) { Prog_Cd = "SRC"; } else { Prog_Cd = "SED"; } // if(!MSG_MISSNO_CLF_CD[0].equals("C")){//20230307 //写入操作记录 20190513 wl param33.setValueParamter(0,REG_ID[0] ); param33.setValueParamter(1,MSG_COIL_NO[0] ); getDao("mesdao").update("UIH020030_COIL_HIS.insert",param33); param22.setValueParamter(0,MSG_SLAB_NO[0] ); param22.setValueParamter(1,StatCd ); param22.setValueParamter(2,MSG_DC_OFF_DTIME[0] ); param22.setValueParamter(3,MSG_COIL_THK[0] ); param22.setValueParamter(4,MSG_COIL_WTH[0] ); param22.setValueParamter(5,MSG_COIL_LTH[0] ); //实际重量 分卷界面可以改磅重,当原磅重为空的时候此界面可以录入磅重 20211013 param22.setValueParamter(6,MSG_ACT_WGT[0] ); //板坯重量对应钢卷的计算重量,存在问题 param22.setValueParamter(7,CalWgt ); param22.setValueParamter(8,MSG_COIL_OUTDIA[0] ); param22.setValueParamter(9,MSG_COIL_INDIA[0] ); param22.setValueParamter(10,MSG_MISSNO_CLF_CD[0] ); param22.setValueParamter(11,MSG_MISSNO_CAUSE_CD[0] ); param22.setValueParamter(12,MSG_MISSNO_DTIME[0] ); param22.setValueParamter(13,Prog_Cd ); param22.setValueParamter(14,MSG_DC_ON_DTIME[0] ); param22.setValueParamter(15,MSG_DC_OFF_DTIME[0] ); param22.setValueParamter(16,MISSNO_CAUSE_QY[0] ); param22.setValueParamter(17,MSG_COIL_NO[0] ); //加入废钢原因、废钢处理时间、SCRAP_WGT,在输入废弃原因代码的时候 getDao("mesdao").update("UIH020030_COIL.update",param22); //写入操作记录 20190513 wl param33 = new PosParameter(); param33.setValueParamter(0,MSG_SLAB_NO[0] ); param33.setValueParamter(1,MSG_COIL_LTH[0] ); param33.setValueParamter(2,MSG_COIL_OUTDIA[0] ); param33.setValueParamter(3,MSG_COIL_THK[0] ); param33.setValueParamter(4,MSG_COIL_WTH[0] ); param33.setValueParamter(5,MSG_ACT_WGT[0] ); param33.setValueParamter(6,REG_ID[0] ); getDao("mesdao").update("UIH020030_COIL_HIS2.insert",param33); //} // 更新TBH02_COIL_COMM_D表 /* param12.setWhereClauseParameter(0, COIL_CUT_SEQ); param12.setWhereClauseParameter(1, SPEC_ORD_THK); param12.setWhereClauseParameter(2, SPEC_ORD_WTH); param12.setWhereClauseParameter(3, SPEC_ORD_LEN); param12.setWhereClauseParameter(4, SPEC_ORD_WGT); param12.setWhereClauseParameter(5, SPEC_ORD_WGT_MIN); param12.setWhereClauseParameter(6, SPEC_ORD_WGT_MAX); param12.setWhereClauseParameter(7, SPEC_ORD_INDIA); param12.setWhereClauseParameter(8, SPEC_ORD_OUTDIA); param12.setWhereClauseParameter(9, SPEC_ORD_NO); param12.setWhereClauseParameter(10, SPEC_ORD_SEQ); param12.setWhereClauseParameter(11, SPEC_ORD_FL); param12.setWhereClauseParameter(12, MSG_COIL_NO[0]); //这里与NIU 同步,一样的做法 this.getDao("mesdao").update("NIH020050_03.update",param12); */ } } else { param22.setValueParamter(0,MSG_COIL_NO[0] ); param22.setValueParamter(1,MSG_SLAB_NO[0] ); //卷取结束时刻 对应 轧钢时间 param22.setValueParamter(2,MSG_DC_OFF_DTIME[0] ); param22.setValueParamter(3,SPEC_STL_GRD ); param22.setValueParamter(4,SPEC_SPEC_ABBSYM ); param22.setValueParamter(5,SPEC_ORD_NO ); param22.setValueParamter(6,SPEC_ORD_SEQ ); param22.setValueParamter(7,SPEC_ORD_USE_CD ); param22.setValueParamter(8,SPEC_PRODNM_CD ); param22.setValueParamter(9,SPEC_ORD_FL ); param22.setValueParamter(10,MSG_COIL_THK[0] ); param22.setValueParamter(11,MSG_COIL_WTH[0] ); param22.setValueParamter(12,MSG_COIL_LTH[0] ); param22.setValueParamter(13,MSG_ACT_WGT[0] ); param22.setValueParamter(14,CalWgt ); param22.setValueParamter(15,MSG_COIL_OUTDIA[0] ); param22.setValueParamter(16,MSG_COIL_INDIA [0] ); param22.setValueParamter(17,MSG_MISSNO_CLF_CD[0] ); param22.setValueParamter(18,MSG_MISSNO_CAUSE_CD[0] ); param22.setValueParamter(19,MSG_MISSNO_DTIME[0] ); //使用转换后的平整分卷标志 param22.setValueParamter(20,SpmYn); param22.setValueParamter(21,SPEC_DEVLMT_DTIME ); param22.setValueParamter(22,SPEC_ORDCUST_CD ); param22.setValueParamter(23,SPEC_PATH_MILL_CD ); param22.setValueParamter(24,SPEC_PACK_METHOD ); param22.setValueParamter(25,SPEC_INDIA ); param22.setValueParamter(26,SPEC_OUTDIA ); param22.setValueParamter(27,SPEC_THK ); param22.setValueParamter(28,SPEC_WTH ); param22.setValueParamter(29,SPEC_WGT ); param22.setValueParamter(30,SPEC_DEST_CD ); param22.setValueParamter(31,MSG_DC_ON_DTIME[0] ); param22.setValueParamter(32,MSG_DC_OFF_DTIME[0] ); param22.setValueParamter(33,StatCd ); param22.setValueParamter(34,XIN_SPEC_STL_GRD ); param22.setValueParamter(35,MISSNO_CAUSE_QY[0] ); //加入废钢原因、废钢处理时间、SCRAP_WGT,在输入废弃原因代码的时候 getDao("mesdao").insert("UIH020030_COIL.insert",param22); //写入操作记录 20190513 wl param33.setValueParamter(0,MSG_SLAB_NO[0] ); param33.setValueParamter(1,MSG_COIL_LTH[0] ); param33.setValueParamter(2,MSG_COIL_OUTDIA[0] ); param33.setValueParamter(3,MSG_COIL_THK[0] ); param33.setValueParamter(4,MSG_COIL_WTH[0] ); param33.setValueParamter(5,MSG_ACT_WGT[0] ); param33.setValueParamter(6,REG_ID[0] ); getDao("mesdao").update("UIH020030_COIL_HIS2.insert",param33); // 从TBF02_SPEC_MILL_D中取得数据 需要插入到TBH02_COIL_COMM_d表中 param3.setWhereClauseParameter(0, SLAB_EDT_SEQ); PosRowSet SpecMillVo_D = this.getDao("mesdao").find("NIH020050_04.select",param3); while (SpecMillVo_D.hasNext() ) { PosRow SpecMillROW_D = SpecMillVo_D.next(); //切割顺序 COIL_CUT_SEQ = (String)SpecMillROW_D.getAttribute("COIL_CUT_SEQ"); //订单厚度 SPEC_ORD_THK = (Number)SpecMillROW_D.getAttribute("ORD_THK"); // 订单宽度 SPEC_ORD_WTH = (Number)SpecMillROW_D.getAttribute("ORD_WTH"); // 订单长度 SPEC_ORD_LEN = (Number)SpecMillROW_D.getAttribute("ORD_LEN"); //订单重量 SPEC_ORD_WGT = (Number)SpecMillROW_D.getAttribute("ORD_WGT"); //订单重量上限 SPEC_ORD_WGT_MIN = (Number)SpecMillROW_D.getAttribute("ORD_WGT_MIN"); //订单重量下限 SPEC_ORD_WGT_MAX = (Number)SpecMillROW_D.getAttribute("ORD_WGT_MAX"); //定单内径 SPEC_ORD_INDIA = (Number)SpecMillROW_D.getAttribute("ORD_INDIA"); //定单外径 SPEC_ORD_OUTDIA = (Number)SpecMillROW_D.getAttribute("ORD_OUTDIA"); //定单余材区分 SPEC_ORD_FL = (String)SpecMillROW_D.getAttribute("ORD_FL"); //状态区分没有实际作用,所以不取出来 //插入钢卷详细信息表,与NIU对应起来 param12.setValueParamter(0, MSG_COIL_NO[0]); param12.setValueParamter(1, COIL_CUT_SEQ); param12.setValueParamter(2, SPEC_ORD_THK); param12.setValueParamter(3, SPEC_ORD_WTH); param12.setValueParamter(4, SPEC_ORD_LEN); param12.setValueParamter(5, SPEC_ORD_WGT); param12.setValueParamter(6, SPEC_ORD_WGT_MIN); param12.setValueParamter(7, SPEC_ORD_WGT_MAX); param12.setValueParamter(8, SPEC_ORD_INDIA); param12.setValueParamter(9, SPEC_ORD_OUTDIA); param12.setValueParamter(10, SPEC_ORD_NO); param12.setValueParamter(11, SPEC_ORD_SEQ); param12.setValueParamter(12, SPEC_ORD_FL); this.getDao("mesdao").insert("NIH020050_03.insert",param12); } } if (ProgCd == null || ProgCd.equals("") || ProgCd.equals("SED")) { PosParameter param13 = new PosParameter(); param13.setWhereClauseParameter(0, MSG_SLAB_NO[0] ); param13.setWhereClauseParameter(1, MSG_COIL_NO[0] ); PosRowSet specMillVo = getDao("mesdao").find("NIH020020_SPEC_MILL.select", param13); if (specMillVo.hasNext()) { PosRow specMillROW = specMillVo.next(); Number SlabEdtSeq = (Number)specMillROW.getAttribute("SLAB_EDT_SEQ"); PosParameter param14 = new PosParameter(); param14.setWhereClauseParameter(0, "C" ); param14.setWhereClauseParameter(1, MSG_SLAB_NO[0] ); param14.setWhereClauseParameter(2, MSG_COIL_NO[0] ); getDao("mesdao").update("NIH020020_SPEC_MILL.update", param14); PosParameter param15 = new PosParameter(); param15.setWhereClauseParameter(0, "C" ); param15.setWhereClauseParameter(1, SlabEdtSeq ); getDao("mesdao").update("NIH020020_SPEC_MILL_D.update", param15); PosParameter param16 = new PosParameter(); param16.setWhereClauseParameter(0, "C" ); param16.setWhereClauseParameter(1, SlabEdtSeq ); getDao("mesdao").update("NIH020020_MILL_IDX.update", param16); } PosParameter param5 = new PosParameter(); //TL 卷取 param5.setWhereClauseParameter(0, "4"); param5.setWhereClauseParameter(1, MSG_SLAB_NO[0]); param5.setWhereClauseParameter(2, MSG_COIL_NO[0]); getDao("mesdao").update("UIH020020_07.update", param5); PosParameter param6 = new PosParameter(); param6.setWhereClauseParameter(0, MSG_SLAB_NO[0]); getDao("mesdao").update("UIH020020_08.update", param6); if(COIL_STAT.equals("3")){//20230302 if(MSG_MISSNO_CLF_CD[0].equals("C")){//如果人工录入轧废信息,需要手动新增轧制消耗、计划产出、产品判废 2021-12-09 ProduceFactory PD= new ProduceFactory(); PD.ErpDataCover("HSLAB",MSG_SLAB_NO[0],"41A","0","O","加热炉二级","热轧轧制"); PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11A","0","O","计划产出","热轧轧制"); PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11AZ","0","O","计划产出判废","热轧轧制"); } } //这里需要判断,如果存在钢卷废弃区分代码的话就不能调用品质的存储过程和相应的进程类 if( !MSG_MISSNO_CLF_CD[0].equals("") && MSG_MISSNO_CLF_CD[0] != null){ if(!COIL_STAT.equals("3")){ if(MSG_MISSNO_CLF_CD[0].equals("C")){//如果人工录入轧废信息,需要手动新增轧制消耗、计划产出、产品判废 2021-12-09 ProduceFactory PD= new ProduceFactory(); PD.ErpDataCover("HSLAB",MSG_SLAB_NO[0],"41A","0","O","加热炉二级","热轧轧制"); PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11A","0","O","计划产出","热轧轧制"); PD.ErpDataCover("HFG",MSG_SLAB_NO[0],"11AZ","0","O","计划产出判废","热轧轧制"); } logger.logInfo("PosSaveMillResult 废弃的钢卷状态为 :"+COIL_STAT); String SlabCurrProgCd = null; String SlabBefProgCd = null; String SlabOrdNo = null; String SlabOrdSeq = null; BigDecimal Slab_Wgt = null; PosParameter param9 = new PosParameter(); param9.setWhereClauseParameter(0, MSG_SLAB_NO[0] ); PosRowSet SlabEndVo = getDao("mesdao").find("NIH020030_SLAB.select", param9); if(SlabEndVo.hasNext()) { PosRow SlabEndROW = SlabEndVo.next(); SlabCurrProgCd = (String)SlabEndROW.getAttribute("CUR_PROG_CD"); SlabBefProgCd = (String)SlabEndROW.getAttribute("BEF_PROG_CD"); SlabOrdNo = (String)SlabEndROW.getAttribute("ORD_NO"); SlabOrdSeq = (String)SlabEndROW.getAttribute("ORD_SEQ"); Slab_Wgt = (BigDecimal)SlabEndROW.getAttribute("SLAB_WGT"); } SendProg_NIE012070( MSG_SLAB_NO[0] ,SlabOrdNo,SlabOrdSeq,SlabCurrProgCd,SlabBefProgCd,"TM",Slab_Wgt,MSG_WK_EMP_NO[0] ); //BigDecimal CoilWgt = new BigDecimal(MSG_ACT_WGT[0]); //当前状态和前状态都为空,留到后面与现场人员确定 //SendProg_NIE012070( MSG_COIL_NO[0] ,SPEC_ORD_NO,SPEC_ORD_SEQ,"","","AR",CoilWgt,MSG_WK_EMP_NO[0] ); SendProg_NIE012080(); //这里如果存在轧废的情况,需要调用品质的存储过程 logger.logInfo("PosSaveMillResult---> NIB027010 TC sql call" ); CallableStatement PlRtn = getDao("mesdao").getCallableStatement("NIH020020_NIB027010"); logger.logInfo("PosSaveMillResult---> NIB027010 TC try" ); try { if(PlRtn != null) { PlRtn.setString(1,MSG_COIL_NO[0]); //新增加一个字段,为了废弃的时候使用 PlRtn.setString(2,"C"); 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("PosSaveMillResult---> NIB027010 TC PlRtn1:["+sRetCode+"]:"+ sRetMsg); } else { logger.logInfo("PosSaveMillResult---> 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("PosSaveMillResult---> NIB027010 SQLException:"+e ); } } } }else{ logger.logInfo("PosSaveMillResult 废弃的钢卷不能调用品质和进程,钢卷状态为 :"+COIL_STAT); } } else{ if(COIL_STAT.equals("1") || COIL_STAT.equals("")){ logger.logInfo("PosSaveMillResult 轧制的钢卷状态为 :"+COIL_STAT); //TL 加入调用品质的存储过程 COPY XinSaveRhfExtract NIB028070 081216 CallableStatement PlRtn = getDao("mesdao").getCallableStatement("NIH020050_NIB028040"); try { if(PlRtn != null) { PlRtn.setString(1, MSG_COIL_NO[0]); PlRtn.registerOutParameter(2, java.sql.Types.VARCHAR); PlRtn.registerOutParameter(3, java.sql.Types.VARCHAR); PlRtn.execute(); String sRetCode = PlRtn.getString(2); String sRetMsg = PlRtn.getString(3); logger.logInfo("PosSAveOutHeatFurnace---> NIB028040 TC PlRtn1:["+sRetCode+"]:"+ sRetMsg); } } catch (SQLException e) { throw new PosException(e.getMessage()); }finally { if (PlRtn != null) { try { PlRtn.close(); } catch (SQLException e) { logger.logWarn(e.getMessage(), e); } } } String SlabCurrProgCd = null; String SlabBefProgCd = null; String SlabOrdNo = null; String SlabOrdSeq = null; BigDecimal Slab_Wgt = null; PosParameter param9 = new PosParameter(); param9.setWhereClauseParameter(0, MSG_SLAB_NO[0] ); PosRowSet SlabEndVo = getDao("mesdao").find("NIH020030_SLAB.select", param9); if(SlabEndVo.hasNext()) { PosRow SlabEndROW = SlabEndVo.next(); SlabCurrProgCd = (String)SlabEndROW.getAttribute("CUR_PROG_CD"); SlabBefProgCd = (String)SlabEndROW.getAttribute("BEF_PROG_CD"); SlabOrdNo = (String)SlabEndROW.getAttribute("ORD_NO"); SlabOrdSeq = (String)SlabEndROW.getAttribute("ORD_SEQ"); Slab_Wgt = (BigDecimal)SlabEndROW.getAttribute("SLAB_WGT"); } SendProg_NIE012070( MSG_SLAB_NO[0] ,SlabOrdNo,SlabOrdSeq,SlabCurrProgCd,SlabBefProgCd,"TM",Slab_Wgt,MSG_WK_EMP_NO[0] ); BigDecimal CoilWgt = new BigDecimal(MSG_ACT_WGT[0]); SendProg_NIE012070( MSG_COIL_NO[0] ,SPEC_ORD_NO,SPEC_ORD_SEQ,"SED","","AR",CoilWgt,MSG_WK_EMP_NO[0] ); SendProg_NIE012080(); }else{ logger.logInfo("PosSaveMillResult 多次轧制的钢卷不能调用品质和进程,钢卷状态为 :"+COIL_STAT); } } } } else{ logger.logInfo("PosSaveMillResult 入炉状态不为2 不能进行轧制实际 :"+RHF_STAT); String vtemp="RHF_STAT"; context.put("rs", vtemp); } }catch(Exception e){ logger.logInfo("PosSaveMillResult 数据格式异常 :"+e.getMessage()); } return PosBizControlConstants.SUCCESS; } public void SendProg_NIE012070(String MatNo,String sOrdNo,String sOrdSeq,String sProgCd,String sBefProgCd,String sKind,BigDecimal wgt,String RegId ) { 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",sOrdNo); message.setObject("ORD_SEQ",sOrdSeq); message.setObject("BEF_PROG_CD",sBefProgCd); message.setObject("PROG_CD",sProgCd); message.setObject("MAT_TYPE",sKind); message.setObject("MAT_NO",MatNo); message.setObject("WGT", wgt ); message.setObject("PGMID","PosSaveMillResult"); message.setObject("REG_ID",""); context.setMessage(message); this.processComponent(PosConstants.CREATE_MESSAGE, context); String transactionCode = context.getMessage().getTC(); 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); } public void 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(); 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); } }