| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636 |
- package UIM;
- import java.sql.Connection;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.Iterator;
- import java.util.List;
- import java.util.Map;
- import UIM.UIM01.BEANS.ColdCoilComm;
- import CoreFS.SA01.CoreIComponent;
- import CoreFS.SA06.CoreReturnObject;
- public class UIM030100 extends CoreIComponent {
- /**
- * 查询钢卷状态
- * @param coilNo
- * @return CoreReturnObject
- * @throws SQLException
- */
- public CoreReturnObject queryCoilStatus(String coilNo) throws SQLException
- {
- CoreReturnObject cro = new CoreReturnObject();
- String sql = "select COIL_THK,COIL_WTH,COIL_LEN,ACT_WGT,CAL_WGT," +
- "decode(CUR_PROG_CD,'DDB','成品卷入库待机','CRC','酸轧卷充当待机'," +
- "'DRC','连退卷充当待机','DBA','重卷指示待机','DBB','重卷作业待机'," +
- "'DCA','包装指示待机','DCB','包装作业待机','DED','综合判定待机'," +
- "'DFA','发货指示待机','DFB','发货待机','DFF','发货完成') CUR_PROG_CD," +
- "DECODE(TOT_DEC_GRD,'1','合格','2','不合格',null,'待判定') TOT_DEC_GRD," +
- "YARD_ENTRY_REG,YARD_ENTRY_USE_TIME from c_tbc02_coil_comm WHERE OLD_SAMPL_NO = '" +
- coilNo + "'";
- cro = this.getDao("KgDao").ExcuteQuery(sql);
- return cro;
- }
-
-
- /**
- * 成品库钢卷入库
- * @param coilNo 钢卷号
- * @param yardAddr 垛位
- * @param entryShift 入库班次
- * @param entryGroup 入库班组
- * @param entryDtime 入库时间
- * @param reg_id 操作人
- * @return CoreReturnObject
- * @throws SQLException
- */
- public CoreReturnObject saveCoilYard(String coilNo,String yardAddr,String entryShift,
- String entryGroup,String entryDtime,String reg_id) throws SQLException
- {
- CoreReturnObject cro = new CoreReturnObject();
-
- //查询钢卷入库信息
- String sqlEntry = "select COIL_NO from c_tbc02_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_tbc02_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();
- Connection con =pSta.getConnection();
- if(rs.next()){
- seq = rs.getLong("ROLL_SEQ");
- }
- //20131014系统连接异常优化
- this.getDao("KgDao").closeRs(rs);
- try{
- pSta.close(); //添加了关闭pSta;
- 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});
- }
- }
-
- return cro;
- }
-
- /**
- * 查询连退计划
- *
- * @param ordNo
- * 合同号
- * @param ordSeq
- * 订单号
- * @param coilNo
- * 热轧卷号
- * @return CoreReturnObject
- * @throws SQLException
- */
- public CoreReturnObject queryMillPlan(String coilNo) throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- StringBuffer sqlBuffer = new StringBuffer();
- sqlBuffer.append("SELECT \n");
- sqlBuffer.append("a.ROLL_MANA_NO --轧制单元号\n");
- sqlBuffer.append(",a.ROLL_COIL_SEQ --单元内序号\n");
- sqlBuffer.append(",a.COIL_EDT_SEQ --轧制序号\n");
- sqlBuffer.append(",a.C_COIL_NO --冷卷号 \n");
- sqlBuffer.append(",a.COIL_NO --热卷号 \n");
- sqlBuffer.append(",a.SPEC_STL_GRD --酸轧牌号 \n");
- sqlBuffer.append(",a.STL_GRD --热轧牌号 \n");
- sqlBuffer.append(",a.STL_GRP_CD --钢号组 \n");
- sqlBuffer.append(",a.COIL_THK --热卷厚度 \n");
- sqlBuffer.append(",a.COIL_WTH --热卷宽度 \n");
- sqlBuffer.append(",a.COIL_WGT --热卷重量 \n");
- sqlBuffer.append(",b.CUR_LOAD_LOC --堆放位置 \n");
- sqlBuffer.append(",a.ORD_NO --合同号 \n");
- sqlBuffer.append(",a.ORD_SEQ --订单号 \n");
- sqlBuffer.append(",a.ORD_THK --订单厚度 \n");
- sqlBuffer.append(",a.ORD_WTH --订单宽度 \n");
- sqlBuffer.append(",a.ORD_WGT --订单重量 \n");
- sqlBuffer.append(",a.ORD_WGT_MIN --订单下限 \n");
- sqlBuffer.append(",a.ORD_WGT_MAX --订单上限 \n");
- sqlBuffer.append(",a.ORD_INDIA --订单内径 \n");
- sqlBuffer.append(",a.ORD_OUTDIA --订单外径 \n");
- sqlBuffer.append("FROM c_tbf04_spec_mill a, \n");
- sqlBuffer.append("c_tbc02_coil_comm b \n");
- sqlBuffer.append("WHERE a.COIL_NO = b.COIL_NO \n");
- sqlBuffer.append("and a.STATUS_CD = 'A' \n");
- sqlBuffer.append("and b.COIL_NO like ?||'%' \n");
- sqlBuffer.append("ORDER BY a.ROLL_MANA_NO,a.ROLL_COIL_SEQ \n");
- cro = this.getDao("KgDao").ExcuteQuery(sqlBuffer.toString(),
- new Object[] { coilNo });
- return cro;
- }
- public CoreReturnObject saveCoilOut(Integer outType, String coilNo,
- String regId, String trnfShift, String trnfGroup, String trnfTime,
- String trnfRemark) throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- // 清除原料库垛位表钢卷信息并将原料公共表钢卷垛位信息置为出库
- boolean crs = cleanCoil(outType.intValue(), coilNo, regId, trnfShift,
- trnfGroup, trnfTime, trnfRemark);
- if (crs) {
- // 如果是退回出库,将热轧公共表钢卷数据改为可入库
- if (3 == outType.intValue()) {
- }
- // 修改进程、计划
- }
- return cro;
- }
- /**
- * 清空钢卷库存信息
- *
- * @param outType
- * 出库类型
- * @param coilNo
- * 钢卷号
- * @param regId
- * 出库人
- * @param trnfShift
- * 出库班次
- * @param trnfGroup
- * 出库班组
- * @param tranTime
- * 出库时间
- * @return boolean
- */
- private boolean cleanCoil(int outType, String coilNo, String regId,
- String trnfShift, String trnfGroup, String trnfTime,
- String trnfRemark) throws SQLException {
- // 根据钢卷号查询垛位编号
- String sql1 = "select clf_no from c_tbk08_coil_yard where coil_no = '"
- + coilNo + "'";
- ResultSet rs = this.getDao("KgDao").ExceuteQueryForResultSet(sql1);
- long yardNo = 0;
- // 如果钢卷在原料库中,查询出相应的垛位编号
- if (rs.next()) {
- yardNo = Long.parseLong(rs.getObject("clf_no").toString());
- } else {
- return false;
- }
- //20131014系统连接异常优化
- this.getDao("KgDao").closeRs(rs);
- // 根据垛位编号清除钢卷信息
- String sql2 = "update c_tbk08_coil_yard set coil_no = '' where clf_no = ?";
- this.getDao("KgDao").ExcuteNonQuery(sql2, new Object[] { yardNo });
- // 修改原料公共表钢卷操作信息
- StringBuffer sql3 = new StringBuffer();
- sql3.append("update c_tbc02_coil_comm set \n");
- sql3.append("coil_stat = '3', --进程状态\n");
- // 如果是上料出库,更新物料进程代码为酸轧卷取待机,如果是退废或退回出库,不处理
- switch (outType) {
- case 1:
- sql3.append("cur_prog_cd = 'PCC', --物料进程代码\n");
- break;
- case 2:
- trnfRemark = "退废";
- break;
- case 3:
- trnfRemark = "退回";
- break;
- }
- sql3.append("trnf_reg = :1, --出库人\n");
- sql3.append("trnf_shift=:2, --出库班次\n");
- sql3.append("trnf_group=:3, --出库班组\n");
- sql3
- .append("trnf_use_time=TO_CHAR(SYSDATE,'YYYYMMDDHH24MIDD'), --出库操作时间\n");
- sql3.append("trnf_dtime=:4, --出库时间\n");
- sql3.append("trnf_remark=:5 --出库备注\n");
- sql3.append("where coil_no = :6 --钢卷号\n");
- this.getDao("KgDao").ExcuteNonQuery(
- sql3.toString(),
- new Object[] { regId, trnfShift, trnfGroup, trnfTime, coilNo,
- trnfRemark });
- return true;
- }
-
- /**
- * 查询钢卷信息
- *
- * @param coilNo
- * 热轧卷号
- * @return CoreReturnObject
- * @throws SQLException
- */
- public CoreReturnObject queryCoilInfo(String coilNo) throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- StringBuffer sqlBuffer = new StringBuffer();
- sqlBuffer
- .append("SELECT A.SPEC_STL_GRD,A.COIL_THK||'*'||A.COIL_WTH T_W,\n");
- sqlBuffer.append(" A.INSTR_COIL_THK||'*'||A.INSTR_COIL_WTH IT_IW,\n");
- sqlBuffer
- .append(" A.ORD_NO,A.ORD_SEQ,A.COIL_LEN,A.ACT_WGT,A.CAL_WGT,\n");
- sqlBuffer
- .append(" DECODE(A.CUR_PROG_CD,'PAB','原料库入库待机','PRC','原料库充当待机','PCA','酸轧指示待机','PCB','酸轧轧制待机','PCC','酸轧卷取待机',null) CUR_PROG_CD,\n");
- sqlBuffer
- .append(" DECODE(A.TOT_DEC_GRD,'1','合格','2','不合格','3','次品','4','废品','','待判定') TOT_DEC_GRD,\n");
- sqlBuffer
- .append(" DECODE(A.ORD_FL,'1','订单材','2','余材','','未判') ORD_FL,\n");
- sqlBuffer
- .append(" DECODE(A.COIL_STAT,'1','未入库','2','在库','3','出库/结束',null) COIL_STAT,\n");
- sqlBuffer
- .append(" A.COIL_IN_REG,A.COIL_IN_DTIME,A.COIL_OUT_REG,A.COIL_OUT_DTIME\n");
- sqlBuffer.append(" FROM C_TBC02_COIL_COMM A WHERE A.COIL_NO = ? \n");
- cro = this.getDao("KgDao").ExcuteQuery(sqlBuffer.toString(),
- new Object[] { coilNo });
- return cro;
- }
-
- /**
- * 盘入盘出操作
- *
- * @param type
- * 盘入/盘出 0/1
- * @param coilNo
- * 钢卷号
- * @param curLoadLoc
- * 垛位
- * @param regId
- * 盘入人
- * @return
- * @throws SQLException
- */
- public CoreReturnObject save(Integer type, String coilNo,
- String curLoadLoc, String regId) throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- // 判断是做盘入操作还是做盘出操作
- if (0 == type.intValue()) {
- // 盘入操作,首先要检查钢卷号是否存在系统。不存在的情况下给予提示
- ColdCoilComm coldCoil = findCoil(coilNo, 0);
- if (null != coldCoil && !isNull(coldCoil.getCoilNo())) {
- // 正常出库的卷暂时不允许发货
- if ("3".equals(coldCoil.getCoilStat())
- && "PCC".equals(coldCoil.getCurProgCd())
- && !isNull(coldCoil.getTrnfDTime())) {
- // 抛出异常
- cro.setV_errCode(new Integer(1));
- cro.setV_errMsg("需要盘入库的钢卷属于正常出库,不能进行盘入操作!");
- } else {
- // 输入垛位为空或不存在此垛位
- if (!isNull(curLoadLoc) && hasYard(curLoadLoc)) {
- // 检查要盘入的垛位上是否存在钢卷
- String coilNoTmp = this.hasCoilOnYard(curLoadLoc);
- if (isNull(coilNoTmp)) {
- // 人工盘入库的卷改为余材
- StringBuffer updCommBuffer = new StringBuffer();
- updCommBuffer
- .append("UPDATE C_TBC02_COIL_COMM A SET \n");
- updCommBuffer.append(" A.CUR_LOAD_LOC = ?,\n");
- updCommBuffer.append(" A.COIL_IN_REG = ?,\n");
- updCommBuffer.append(" A.CUR_PROG_CD = 'PRC',\n");
- updCommBuffer.append(" A.CUR_PROG_CD_PGM = 'UIM030100',\n");
- updCommBuffer.append(" A.CUR_PROG_CD_DTIME = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS'),\n");
- updCommBuffer.append(" A.COIL_STAT = '2',\n");
- updCommBuffer.append("A.ORD_FL = '2',\n");
- updCommBuffer.append(" A.ORD_NO = '',\n");
- updCommBuffer.append(" A.ORD_SEQ = '',\n");
- updCommBuffer
- .append(" A.COIL_IN_DTIME = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')\n");
- updCommBuffer.append(" WHERE A.COIL_NO = ?\n");
- this.getDao("KgDao").ExcuteNonQuery(
- updCommBuffer.toString(),
- new Object[] { curLoadLoc, regId, coilNo });
- // 更新原料公共_D表
- StringBuffer updCommDBuffer = new StringBuffer();
- updCommDBuffer
- .append("UPDATE C_TBC02_COIL_COMM_D A SET\n");
- updCommDBuffer.append(" A.ORD_FL = '2'\n");
- updCommDBuffer.append(" WHERE A.COIL_NO = ?\n");
- this.getDao("KgDao").ExcuteNonQuery(
- updCommDBuffer.toString(),
- new Object[] { coilNo });
- // 将钢卷信息录入垛位表
- StringBuffer updYardBuffer = new StringBuffer();
- updYardBuffer
- .append("UPDATE C_TBH08_COIL_YARD A SET\n");
- updYardBuffer.append(" A.COIL_NO = ?\n");
- updYardBuffer.append(" WHERE A.CLF_NAME = ?\n");
- updYardBuffer.append(" AND A.CLF_ROW = ?\n");
- updYardBuffer.append(" AND A.CLF_COL = ?\n");
- updYardBuffer.append(" AND A.CLF_FL = ?\n");
- this.getDao("KgDao").ExcuteNonQuery(
- updYardBuffer.toString(),
- new Object[] { coilNo,
- curLoadLoc.substring(0, 5),
- curLoadLoc.substring(5, 7),
- curLoadLoc.substring(7, 9),
- curLoadLoc.substring(9, 10) });
- }
- } else {
- cro.setV_errCode(new Integer(2));
- cro.setV_errMsg("需要盘入库的钢卷垛位信息不正确,请输入正确的垛位后再进行相应操作!");
- }
- }
- } else {
- cro.setV_errCode(new Integer(3));
- cro.setV_errMsg("需要盘入库的钢卷在库存中,请确认后再进行相应操作!");
- }
- } else {
- // 盘出操作,首先要检查钢卷号是否存在系统。不存在的情况下给予提示
- ColdCoilComm coldCoil = findCoil(coilNo, 1);
- if (null != coldCoil && !isNull(coldCoil.getCoilNo())) {
- if ("PCB".equals(coldCoil.getCurProgCd())) {
- cro.setV_errCode(new Integer(4));
- cro.setV_errMsg("需要盘出库的钢卷已经做了轧制计划,请撤销计划后再进行相应操作!");
- } else {
- // 更新原料公共表
- StringBuffer updCommStr = new StringBuffer();
- updCommStr.append("UPDATE C_TBC02_COIL_COMM A SET\n");
- updCommStr.append(" A.COIL_STAT = '3',\n");
- updCommStr.append(" A.CUR_LOAD_LOC = '',\n");
- updCommStr.append(" A.ORD_FL = '2',\n");
- updCommStr.append(" A.ORD_NO = '',\n");
- updCommStr.append(" A.ORD_SEQ = '',\n");
- updCommStr.append(" A.COIL_OUT_REG = ?,\n");
- updCommStr
- .append(" A.COIL_OUT_DTIME = TO_CHAR(SYSDATE,'YYYYMMDDHH24MISS')\n");
- updCommStr.append(" WHERE A.OLD_SAMPL_NO = ?\n");
- this.getDao("KgDao").ExcuteNonQuery(updCommStr.toString(),
- new Object[] { regId, coilNo });
- // 更新原料公共_D表
- StringBuffer updCommDStr = new StringBuffer();
- updCommDStr.append("UPDATE C_TBC02_COIL_COMM_D A SET\n");
- updCommDStr.append(" A.ORD_FL = '2'\n");
- updCommDStr.append(" WHERE A.COIL_NO = ?\n");
- this.getDao("KgDao").ExcuteNonQuery(updCommDStr.toString(),
- new Object[] { coilNo });
- // 更新垛位表
- StringBuffer updYardStr = new StringBuffer();
- updYardStr.append("UPDATE C_TBK08_COIL_YARD T SET\n");
- updYardStr.append(" T.COIL_NO = '',\n");
- updYardStr.append(" T.MOD_ID = '',\n");
- updYardStr.append(" T.MOD_TIME = ''\n");
- updYardStr.append(" WHERE T.COIL_NO = ?\n");
- this.getDao("KgDao").ExcuteNonQuery(updYardStr.toString(),
- new Object[] { coilNo });
- }
- } else {
- cro.setV_errCode(new Integer(5));
- cro.setV_errMsg("需要盘出库的钢卷不在库存中,请确认后再进行相应操作!");
- }
- }
- return cro;
- }
-
- /**
- * 查找钢卷号是否存在
- *
- * @param coilNo
- * @param type
- * 0盘入 1盘出
- * @return
- */
- private ColdCoilComm findCoil(String coilNo, int type) {
- PreparedStatement prepStat = null;
- ColdCoilComm coldCoil = null;
- ResultSet rs = null;
- Connection con =null;
- try {
- StringBuffer sqlBuffer = new StringBuffer();
- sqlBuffer.append("SELECT A.COIL_NO,A.COIL_STAT,\n");
- sqlBuffer.append(" A.SLAB_NO,a.CUR_PROG_CD,\n");
- sqlBuffer.append(" a.TRNF_DTIME FROM C_TBC02_COIL_COMM A \n");
- sqlBuffer.append(" WHERE COIL_NO = ? \n");
- String tmp = 0 == type ? "<>" : "=";
- sqlBuffer.append(" AND A.COIL_STAT " + tmp + " '2'\n");
- prepStat = this.getDao("KgDao").getPreparedStatement(
- sqlBuffer.toString());
- prepStat.setString(1, coilNo);
- con=prepStat.getConnection();
- rs = prepStat.executeQuery();
- if (rs.next()) {
- coldCoil = new ColdCoilComm();
- coldCoil.setCoilNo(rs.getString("COIL_NO"));
- coldCoil.setCoilStat(rs.getString("COIL_STAT"));
- coldCoil.setCurProgCd(rs.getString("CUR_PROG_CD"));
- coldCoil.setSlabNo(rs.getString("SLAB_NO"));
- coldCoil.setTrnfDTime(rs.getString("TRNF_DTIME"));
- }
- } catch (SQLException sqle) {
- } finally {
- try {
- if (null != rs) {
- rs.close();
- }
- if (null != prepStat) {
- prepStat.close();
- }
- if (null != con) {
- con.close();
- }
- } catch (Exception e) {
- }
- }
- return coldCoil;
- }
-
- /**
- * 判断对象是否为空
- *
- * @param obj
- * @return boolean
- */
- private boolean isNull(Object obj) {
- boolean isNull = true;
- if (null != obj && !"".equals(obj)) {
- isNull = false;
- }
- return isNull;
- }
-
- /**
- * 查询垛位是否存在
- *
- * @param curLoadLoc
- * @return
- */
- private boolean hasYard(String curLoadLoc) {
- boolean b = false;
- StringBuffer sqlBuffer = new StringBuffer();
- sqlBuffer
- .append("SELECT A.CLF_NO FROM C_TBK08_COIL_YARD A,C_TBK08_COIL_YARD_AREA B WHERE\n");
- sqlBuffer.append(" A.AREA_NO = B.AREA_NO AND B.AREA_TYPE = '3'\n");
- sqlBuffer
- .append(" AND A.CLF_NAME||to_char(A.CLF_ROW,'00')||to_char(A.CLF_COL,'00')||A.CLF_FL\n");
- sqlBuffer.append(" = ? \n");
- PreparedStatement prep = null;
- ResultSet rs = null;
- Connection con =null;
- try {
- prep = this.getDao("KgDao").getPreparedStatement(
- sqlBuffer.toString());
- prep.setString(0, curLoadLoc);
- rs = prep.executeQuery();
- con=prep.getConnection();
- if (rs.next()) {
- b = true;
- }
- } catch (SQLException sqle) {
- } finally {
- try {
- if (null != rs) {
- rs.close();
- }
- if (null != prep) {
- prep.close();
- }
- if (null != con) {
- con.close();
- }
- } catch (Exception e) {
- }
- }
- return b;
- }
-
- /**
- * 判断原料库垛位上是否存在有钢卷
- *
- * @param curLoadLoc
- * 堆放位置
- * @return String
- */
- private String hasCoilOnYard(String curLoadLoc) {
- String coilNo = "";
- StringBuffer sqlBuffer = new StringBuffer();
- sqlBuffer
- .append("SELECT A.COIL_NO FROM C_TBK08_COIL_YARD A,C_TBK08_COIL_YARD_AREA B WHERE\n");
- sqlBuffer.append(" A.AREA_NO = B.AREA_NO AND B.AREA_TYPE = '3'\n");
- sqlBuffer
- .append(" AND A.CLF_NAME||to_char(A.CLF_ROW,'00')||to_char(A.CLF_COL,'00')||A.CLF_FL\n");
- sqlBuffer.append(" = ? \n");
- PreparedStatement prep = null;
- ResultSet rs = null;
- Connection con =null;
- try {
- prep = this.getDao("KgDao").getPreparedStatement(
- sqlBuffer.toString());
- prep.setString(1, curLoadLoc);
- rs = prep.executeQuery();
- con = prep.getConnection();
- if (rs.next()) {
- coilNo = rs.getString("COIL_NO");
- }
- } catch (SQLException sqle) {
- } finally {
- try {
- if (null != rs) {
- rs.close();
- }
- if (null != prep) {
- prep.close();
- }
- if (null != con) {
- con.close();
- }
- } catch (Exception e) {
- }
- }
- return coilNo;
- }
- /**
- * 查询钢卷位置
- *
- * @param coilNo
- * 热轧卷号
- * @return CoreReturnObject
- * @throws SQLException
- */
- public CoreReturnObject queryLoadLoc(String coilNo) throws SQLException {
- CoreReturnObject cro = new CoreReturnObject();
- StringBuffer sqlBuffer = new StringBuffer();
- sqlBuffer.append("select k.cur_load_loc from c_tbc02_coil_comm k,\n");
- sqlBuffer.append("c_tbk08_coil_yard y,c_tbk08_coil_yard_area a \n");
- sqlBuffer.append("where k.COIL_NO = y.COIL_NO \n");
- sqlBuffer.append("and y.AREA_NO = a.AREA_NO \n");
- sqlBuffer.append("and a.AREA_TYPE = 1 \n");
- sqlBuffer.append("and k.coil_no = ?");
-
- List list = this.getDao("KgDao").ExcuteQueryReturnList(sqlBuffer.toString(),
- new Object[] { coilNo });// .ExcuteQuery(sql);
- String curLoadLoc = "";
- Iterator it = list.iterator();
- while (it.hasNext()) {
- Map map = (Map) it.next();
-
- curLoadLoc = map.get("cur_load_loc").toString();
- }
- // System.out.println(count);
- cro.setResult(curLoadLoc);
- return cro;
- }
- }
|