package UIM; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.List; import com.sun.corba.se.pept.transport.Connection; import CoreFS.SA01.CoreIComponent; import CoreFS.SA06.CoreReturnObject; public class UIM010130 extends CoreIComponent { /** * 中间库外购卷入库 * @param coilNo 钢卷号 * @param yardAddr 垛位 * @param entryShift 入库班次 * @param entryGroup 入库班组 * @param entryDtime 入库时间 * @param reg_id 操作人 * @param element 成份信息 * @param performance 性能信息 * @return CoreReturnObject * @throws SQLException */ public CoreReturnObject saveCoilYard(String coilNo,String yardAddr,String entryShift, String entryGroup,String entryDtime,String reg_id,String element,String performance) throws SQLException { CoreReturnObject cro = new CoreReturnObject(); //查询钢卷入库信息 String sqlEntry = "select COIL_NO from c_tbl02_coil_comm where OLD_SAMPL_NO = ? AND COIL_STAT = '2'"; List listEntry = this.getDao("KgDao").ExcuteQueryReturnList(sqlEntry,new Object[]{coilNo}); if(listEntry.size() < 1){ cro.setV_errCode(new Integer(1)); cro.setV_errMsg("此钢卷没有轧制完成,或者已经出库!"); } else{ //查询钢卷出库信息 String sqlOut = "select COIL_NO from c_tbk08_coil_yard where COIL_NO = ?"; List listOut = this.getDao("KgDao").ExcuteQueryReturnList(sqlOut, new Object[]{coilNo}); if(listOut.size() > 0){ cro.setV_errCode(new Integer(2)); cro.setV_errMsg("此钢卷已在垛位中存在!"); } else{ //将入库操作信息和垛位信息加入冷轧原料公共表 String sqlucomm = "update c_tbl02_coil_comm set CUR_LOAD_LOC = ?," + " CUR_LOAD_LOC_DTIME = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')," + " YARD_ENTRY_SHIFT = ?, YARD_ENTRY_GROUP = ?, YARD_ENTRY_REG = ?," + " YARD_ENTRY_DTIME = ?, " + " YARD_ENTRY_USE_TIME = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')" + " where OLD_SAMPL_NO = ?"; this.getDao("KgDao").ExcuteNonQuery(sqlucomm, new Object[]{yardAddr,entryShift,entryGroup,reg_id,entryDtime,coilNo}); //将钢卷信息加入垛位表 String sqluyard = "update c_tbk08_coil_yard set COIL_NO = ?, " + "MOD_ID = ?, MOD_TIME = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')" + " where CLF_NAME = substr(?,0,5) and CLF_ROW = substr(?,6,2)" + " and CLF_COL = substr(?,8,1) and CLF_FL = substr(?,9,1)"; this.getDao("KgDao").ExcuteNonQuery(sqluyard, new Object[]{coilNo,reg_id,yardAddr,yardAddr,yardAddr,yardAddr}); //入库完成后将入库记录加入移垛记录,便于跟踪钢卷移动记录 long seq = 0;//移垛记录表主键 String sqlqmaxseq = "select max(ROLL_SEQ) ROLL_SEQ from c_tbk08_coil_move"; PreparedStatement pSta = this.getDao("KgDao").getPreparedStatement(sqlqmaxseq); ResultSet rs = pSta.executeQuery(); java.sql.Connection con = pSta.getConnection(); if(rs.next()){ seq = rs.getLong("ROLL_SEQ"); } try{ rs.close(); //添加了关闭连接 pSta.close(); //添加了关闭连接 con.close(); } catch (Exception e) { } String sqlimove = "insert into c_tbk08_coil_move T(T.ROLL_SEQ,T.CUR_LOAD_LOC_F,T.CUR_LOAD_LOC_T,T.COIL_NO,T.REG_ID,T.REG_SHIFT,T.REG_GROUP,T.REG_DTIME,T.REG_USE_ID,T.REG_USE_DTIME)VALUES(?,?,?,?,?,?,?,?,?,TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'))"; this.getDao("KgDao").ExcuteNonQuery(sqlimove, new Object[]{seq,"",yardAddr,coilNo,reg_id,entryShift,entryGroup,entryDtime,reg_id}); //录入钢卷成份信息和性能信息 String []eleArray = element.split("\\|"); String []pfmArray = performance.split("\\|"); //成份信息 String chargeNo = eleArray[0];//炉号 String procCd = eleArray[1];//工序 String chemSeq = eleArray[2];//次数 String chemCd = eleArray[3];//元素名 String chemVar = eleArray[4];//实际值 String imgrRmk = "";//备注 if(eleArray.length > 5){ imgrRmk = eleArray[5]; } //性能信息 } } return cro; } }