package com.steering.pss.ydm.pipeleavefactory;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import CoreFS.SA06.CoreReturnObject;
import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.SC01.CoreConstantData;
import com.steering.comm.db.DBCommon;
import com.steering.comm.tools.EntityTool;
import com.steering.comm.tools.StringTool;
import com.steering.pss.ydm.entity.YdmZcInlistEntity;
import com.steering.pss.ydm.entity.YdmZcOutlistEntity1;

/**
 * 装车皮倒库
 * @author Administrator
 */
public class FrmPuorLib extends DBCommon {

    /**
     * 查询提单从表数据
     * @param list 传递参数
     * @return obj
     */
    public CoreReturnObject queryBillC(String billNo) {
        String sql = CoreXmlSqlParsersFactory.getSql("FrmPuorLib.QueryBillC");
        return this.getData(sql, new Object[] { billNo });
    }

    /**
     * 查询装车皮倒库记录
     * @param list 传递参数
     * @return obj
     */
    public CoreReturnObject queryOut(String billNo) {
        String sql = CoreXmlSqlParsersFactory.getSql("FrmPuorLib.QueryOut");
        return this.getData(sql, new Object[] { billNo });
    }

    /**
     * 查询装车皮倒库记录(坯子)
     * @param list 传递参数
     * @return obj
     */
    public CoreReturnObject queryOutPZ(String billNo) {
        String sql = CoreXmlSqlParsersFactory.getSql("FrmPuorLib.queryOutPZ");
        return this.getData(sql, new Object[] { billNo });
    }
    /**
     * 查询装车皮倒库记录
     * @param list 传递参数
     * @return obj
     */
    public CoreReturnObject queryIn(String billNo) {
        String sql = CoreXmlSqlParsersFactory.getSql("FrmPuorLib.queryIn");
        return this.getData(sql, new Object[] { billNo });
    }
    /**
     * 查询装车皮倒库记录(坯子)
     * @param list 传递参数
     * @return obj
     */
    public CoreReturnObject queryInPZ(String billNo) {
        String sql = CoreXmlSqlParsersFactory.getSql("FrmPuorLib.queryInPZ");
        return this.getData(sql, new Object[] { billNo });
    }

    /**
     * 每支材料对应的倒库（出库）单号
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendOut(Connection conn, String strlist)
            throws Exception {
        int seq = 0;
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyMMdd");
        SimpleDateFormat matter = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPipeEntruck.queryOutList");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter.format(dt));
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            String res = rs.getString(1);
            if (res == null) {
                res = "OF" + matter1.format(dt) + "00001";
            }
            else {
                seq = Integer.parseInt(res.substring(res.length() - 5, res
                        .length()));
            }
        }
        rs.close();
        psta.close();
        return "OF" + matter1.format(dt)
                + StringTool.formatDecimal(++seq, "00000");
    }
    /**
     * 每支材料对应的倒库（出库）单号(坯子)
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendOutPZ(Connection conn, String strlist)
            throws Exception {
        int seq = 0;
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyMMdd");
        SimpleDateFormat matter = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPuorLib.queryOutListPZ");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter.format(dt));
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            String res = rs.getString(1);
            if (res == null) {
                res = "OF" + matter1.format(dt) + "00001";
            }
            else {
                seq = Integer.parseInt(res.substring(res.length() - 5, res
                        .length()));
            }
        }
        rs.close();
        psta.close();
        return "OF" + matter1.format(dt)
                + StringTool.formatDecimal(++seq, "00000");
    }

    /**
     * 每支材料对应的入库单号
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendIn(Connection conn, String strlist) throws Exception {
        int seq = 0;
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyMMdd");
        SimpleDateFormat matter = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPuorLib.QUERYInMax");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter.format(dt));
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            String res = rs.getString(1);
            if (res == null) {
                res = "IF" + matter1.format(dt) + "00001";
            }
            else {
                seq = Integer.parseInt(res.substring(res.length() - 5, res
                        .length()));
            }
        }
        rs.close();
        psta.close();
        return "IF" + matter1.format(dt)
                + StringTool.formatDecimal(++seq, "00000");
    }
    /**
     * 每支材料对应的入库单号
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendInPZ(Connection conn, String strlist) throws Exception {
        int seq = 0;
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyMMdd");
        SimpleDateFormat matter = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPuorLib.QUERYInMaxPz");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter.format(dt));
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            String res = rs.getString(1);
            if (res == null) {
                res = "IF" + matter1.format(dt) + "00001";
            }
            else {
                seq = Integer.parseInt(res.substring(res.length() - 5, res
                        .length()));
            }
        }
        rs.close();
        psta.close();
        return "IF" + matter1.format(dt)
                + StringTool.formatDecimal(++seq, "00000");
    }
    /**
     * 每支材料对应的倒库（出库）流水号（坯子）
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendOutList(Connection conn, String strlist,
            String strType) throws Exception {
        String seq = "";
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPipeEntruck.queryOut");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter1.format(dt));
        psta.setString(3, strType);
        psta.setString(4, strlist);
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            seq = rs.getString(1);
        }
        rs.close();
        psta.close();
        return seq;
    }
    /**
     * 每支材料对应的倒库（出库）流水号（坯子）
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendOutListPz(Connection conn, String strlist,
            String strType) throws Exception {
        String seq = "";
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPuorLib.queryOutPz");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter1.format(dt));
        psta.setString(3, strType);
        psta.setString(4, strlist);
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            seq = rs.getString(1);
        }
        rs.close();
        psta.close();
        return seq;
    }
    /**
     * 每支材料对应入库流水号
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendInList(Connection conn, String strlist,
            String strType) throws Exception {
        String seq = "";
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPuorLib.QUERYInSeq");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter1.format(dt));
        psta.setString(3, strType);
        psta.setString(4, strlist);
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            seq = rs.getString(1);
        }
        rs.close();
        psta.close();
        return seq;
    }
    /**
     * 每支材料对应入库流水号（坯子）
     * @param conn c
     * @param strlist 传递参数
     * @return obj
     * @throws Exception 异常处理
     */
    public String querySendInListPz(Connection conn, String strlist,
            String strType) throws Exception {
        String seq = "";
        PreparedStatement psta = null;
        Date dt = new Date();
        SimpleDateFormat matter1 = new SimpleDateFormat("yyyy-MM-dd");
        String sqlLovsqe = CoreXmlSqlParsersFactory
                .getSql("FrmPuorLib.QUERYInSeqPz");
        psta = conn.prepareStatement(sqlLovsqe);
        psta.setString(1, strlist);
        psta.setString(2, matter1.format(dt));
        psta.setString(3, strType);
        psta.setString(4, strlist);
        ResultSet rs = psta.executeQuery();
        if (rs.next()) {
            seq = rs.getString(1);
        }
        rs.close();
        psta.close();
        return seq;
    }
    /**
     *新增装车皮倒库记录
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject addBillOut(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sqlquery = "";
        Date nowTime = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyyMM");
        String jsTime = df.format(nowTime);
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqlInset = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.INSERTOUT");// 新增装车皮倒库
            PreparedStatement insertOut = con.prepareStatement(sqlInset);
            String sqlInsetXs = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLibXs.INSERTOUT");// 新增装车皮倒库
            PreparedStatement insertOutXs = con.prepareStatement(sqlInsetXs);
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdate);

            List<YdmZcOutlistEntity1> ydmout = new ArrayList<YdmZcOutlistEntity1>();
            for (int i = 0; i < pram.size(); i++) {
                ydmout.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);
                String name = list.get(5);
                String time = list.get(6);
                String manageNo = list.get(7);
                String manageName = list.get(8);
                String depid = list.get(9);
                String depName = list.get(10);
                String storage = list.get(11);
                String bz = list.get(12);
                String bc = list.get(13);

                String flag = "";
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryFlag");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                if (rs.next()) {
                    flag = rs.getString("MOVE_LOAD_FLAG");
                }
                rs.close();
                ps.close();
                if (!flag.equals("0")) {
                    core.setV_errMsg("该炉不是未进行装车皮倒库状态,不能进行此操作！");
                    return core;
                }

                // 仓库信息
                String starrl = "";// 仓库类型
                String starrlName = "";// 类型名称
                String stoTypNo = "";// 仓库类别
                String stoTypeName = "";// 类别名称
                String lotNo = "";// 位置
                String layNo = "";// 层高
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryStorage");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, storage);
                ps.setObject(2, storage + 10101);
                rs = ps.executeQuery();
                if (rs.next()) {
                    starrl = rs.getString("STORAGE_ATTR");
                    starrlName = rs.getString("STORAGE_ATTR_NAME");
                    stoTypNo = rs.getString("STORAGE_TYPE_NO");
                    stoTypeName = rs.getString("STORAGE_TYPE_NAME");
                    lotNo = rs.getString("COL_MAX_NUM");
                    layNo = rs.getString("LAY_MAX_NUM");
                }
                ps.close();
                rs.close();

                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.qureyBillC");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, ordLnDlyPk);
                ps.setObject(3, jusNo);
                ps.setObject(4, batchNo);
                ps.setObject(5, groupNo);
                rs = ps.executeQuery();
                ydmout = EntityTool.getEntitysByRs(rs,
                        YdmZcOutlistEntity1.class);
                rs.close();
                ps.close();

                String sendOut = querySendOut(con, "800807");
                // 获取出库流水号
                String butessMatNo;
                butessMatNo = querySendOutList(con, sendOut, "800807");

                int outNo = Integer.parseInt(butessMatNo.substring(butessMatNo
                        .length() - 4, butessMatNo.length()));
                for (YdmZcOutlistEntity1 ydmouts : ydmout) {
                    insertOut.setObject(1, sendOut
                            + StringTool.formatDecimal(outNo, "0000"));
                    insertOut.setString(2, sendOut);
                    insertOut.setString(3, "800807");
                    insertOut.setString(4, "装车皮倒出");
                    insertOut.setString(5, "");
                    insertOut.setString(6, ydmouts.getMatNo());
                    insertOut.setString(7, ydmouts.getLotNo());
                    insertOut.setString(8, ydmouts.getStoveNo());
                    insertOut.setString(9, ydmouts.getJudgeStoveNo());
                    insertOut.setString(10, ydmouts.getBatchNo());
                    insertOut.setString(11, ydmouts.getBatchGroudNo());
                    insertOut.setString(12, ydmouts.getMaterialNo());
                    insertOut.setString(13, ydmouts.getMaterialName());
                    insertOut.setString(14, ydmouts.getProduccode());
                    insertOut.setString(15, ydmouts.getProducname());
                    insertOut.setString(16, ydmouts.getStdCode());
                    insertOut.setString(17, ydmouts.getStdName());
                    insertOut.setString(18, ydmouts.getGradecode());
                    insertOut.setString(19, ydmouts.getGradename());
                    insertOut.setString(20, ydmouts.getSteelcode());
                    insertOut.setString(21, ydmouts.getSteelname());
                    insertOut.setString(22, ydmouts.getStdStyle());
                    insertOut.setString(23, ydmouts.getStdStyleDesc());
                    insertOut.setString(24, ydmouts.getSpecCode());
                    insertOut.setString(25, ydmouts.getSpecName());
                    insertOut.setString(26, ydmouts.getModelCode());
                    insertOut.setString(27, ydmouts.getModelDesc());
                    insertOut.setString(28, ydmouts.getPlineCode());
                    insertOut.setString(29, ydmouts.getPlineName());
                    insertOut.setString(30, ydmouts.getActDimater());
                    insertOut.setString(31, ydmouts.getActHeight());
                    insertOut
                            .setString(32, String.valueOf(ydmouts.getActLen()));
                    insertOut.setString(33, String.valueOf(ydmouts
                            .getActLenMin()));
                    insertOut.setString(34, String.valueOf(ydmouts
                            .getActLenMax()));
                    insertOut.setString(35, ydmouts.getActCount());
                    insertOut.setString(36, String.valueOf(ydmouts
                            .getActWeight()));
                    insertOut.setString(37, String.valueOf(ydmouts
                            .getActTheoryWeight()));
                    insertOut.setString(38, ydmouts.getStorageNo());
                    insertOut.setString(39, ydmouts.getLocationNo());
                    insertOut.setString(40, layNo);
                    insertOut.setString(41, lotNo);
                    insertOut.setString(42, starrl);
                    insertOut.setString(43, starrlName);
                    insertOut.setString(44, stoTypNo);
                    insertOut.setString(45, stoTypeName);
                    insertOut.setString(46, manageNo);
                    insertOut.setString(47, manageName);
                    
                    insertOutXs.setObject(1, sendOut
                            + StringTool.formatDecimal(outNo, "0000"));
                    insertOutXs.setString(2, sendOut);
                    insertOutXs.setString(3, "800807");
                    insertOutXs.setString(4, "装车皮倒出");
                    insertOutXs.setString(5, "");
                    insertOutXs.setString(6, ydmouts.getMatNo());
                    insertOutXs.setString(7, ydmouts.getLotNo());
                    insertOutXs.setString(8, ydmouts.getStoveNo());
                    insertOutXs.setString(9, ydmouts.getJudgeStoveNo());
                    insertOutXs.setString(10, ydmouts.getBatchNo());
                    insertOutXs.setString(11, ydmouts.getBatchGroudNo());
                    insertOutXs.setString(12, ydmouts.getMaterialNo());
                    insertOutXs.setString(13, ydmouts.getMaterialName());
                    insertOutXs.setString(14, ydmouts.getProduccode());
                    insertOutXs.setString(15, ydmouts.getProducname());
                    insertOutXs.setString(16, ydmouts.getStdCode());
                    insertOutXs.setString(17, ydmouts.getStdName());
                    insertOutXs.setString(18, ydmouts.getGradecode());
                    insertOutXs.setString(19, ydmouts.getGradename());
                    insertOutXs.setString(20, ydmouts.getSteelcode());
                    insertOutXs.setString(21, ydmouts.getSteelname());
                    insertOutXs.setString(22, ydmouts.getStdStyle());
                    insertOutXs.setString(23, ydmouts.getStdStyleDesc());
                    insertOutXs.setString(24, ydmouts.getSpecCode());
                    insertOutXs.setString(25, ydmouts.getSpecName());
                    insertOutXs.setString(26, ydmouts.getModelCode());
                    insertOutXs.setString(27, ydmouts.getModelDesc());
                    insertOutXs.setString(28, ydmouts.getPlineCode());
                    insertOutXs.setString(29, ydmouts.getPlineName());
                    insertOutXs.setString(30, ydmouts.getActDimater());
                    insertOutXs.setString(31, ydmouts.getActHeight());
                    insertOutXs
                            .setString(32, String.valueOf(ydmouts.getActLen()));
                    insertOutXs.setString(33, String.valueOf(ydmouts
                            .getActLenMin()));
                    insertOutXs.setString(34, String.valueOf(ydmouts
                            .getActLenMax()));
                    insertOutXs.setString(35, ydmouts.getActCount());
                    insertOutXs.setString(36, String.valueOf(ydmouts
                            .getActWeight()));
                    insertOutXs.setString(37, String.valueOf(ydmouts
                            .getActTheoryWeight()));
                    insertOutXs.setString(38, ydmouts.getStorageNo());
                    insertOutXs.setString(39, ydmouts.getLocationNo());
                    insertOutXs.setString(40, layNo);
                    insertOutXs.setString(41, lotNo);
                    insertOutXs.setString(42, starrl);
                    insertOutXs.setString(43, starrlName);
                    insertOutXs.setString(44, stoTypNo);
                    insertOutXs.setString(45, stoTypeName);
                    insertOutXs.setString(46, manageNo);
                    insertOutXs.setString(47, manageName);
                    
                    if (ydmouts.getRpoTime().equals("")) {
                        insertOut.setString(48, "");
                        insertOutXs.setString(48, "");

                    }
                    else {
                        insertOut.setString(48, ydmouts.getRpoTime().substring(
                                0, 19));
                        insertOutXs.setString(48, ydmouts.getRpoTime().substring(
                                0, 19));
                    }
                    insertOut.setString(49, ydmouts.getProBc());
                    insertOut.setString(50, ydmouts.getProBz());
                    insertOut.setString(51, time);
                    insertOut.setString(52, bc);// 班次
                    insertOut.setString(53, bz);// 班组
                    insertOut.setString(54, name);
                    insertOut.setString(55, time);
                    insertOut.setString(56, ydmouts.getOrdPk());
                    insertOut.setString(57, ydmouts.getOrdLnPk());
                    insertOut.setString(58, ydmouts.getOrdLnDlyPk());
                    insertOut.setString(59, ydmouts.getOrderNo());
                    insertOut.setString(60, ydmouts.getOrderSeq());
                    insertOut.setString(61, ydmouts.getDeliveryNo());
                    insertOut.setString(62, depid);
                    insertOut.setString(63, depName);
                    insertOut.setString(64, ydmouts.getBelongCode());
                    insertOut.setString(65, ydmouts.getBelongName());
                    insertOut.setString(66, jsTime);
                    insertOut.setString(67, "801403");
                    insertOut.setString(68, "80150302");
                    insertOut.setString(69, billNo);
                    insertOut.setString(70, ydmouts.getVstel());
                    insertOut.addBatch();
                    insertOutXs.setString(49, ydmouts.getProBc());
                    insertOutXs.setString(50, ydmouts.getProBz());
                    insertOutXs.setString(51, time);
                    insertOutXs.setString(52, bc);// 班次
                    insertOutXs.setString(53, bz);// 班组
                    insertOutXs.setString(54, name);
                    insertOutXs.setString(55, time);
                    insertOutXs.setString(56, ydmouts.getOrdPk());
                    insertOutXs.setString(57, ydmouts.getOrdLnPk());
                    insertOutXs.setString(58, ydmouts.getOrdLnDlyPk());
                    insertOutXs.setString(59, ydmouts.getOrderNo());
                    insertOutXs.setString(60, ydmouts.getOrderSeq());
                    insertOutXs.setString(61, ydmouts.getDeliveryNo());
                    insertOutXs.setString(62, depid);
                    insertOutXs.setString(63, depName);
                    insertOutXs.setString(64, ydmouts.getBelongCode());
                    insertOutXs.setString(65, ydmouts.getBelongName());
                    insertOutXs.setString(66, jsTime);
                    insertOutXs.setString(67, "801403");
                    insertOutXs.setString(68, "80150302");
                    insertOutXs.setString(69, billNo);
                    insertOutXs.setString(70, ydmouts.getVstel());
                    insertOutXs.addBatch();
                    outNo++;
                }
                insertOut.executeBatch();
                insertOutXs.executeBatch();
                updateBillC.setObject(1, "1");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();

            }
            updateBillC.executeBatch();
            core.setV_errMsg("装车皮倒库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }

    /**
     *撤销倒库记录
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject deleteBillOut(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqldelte = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.deleteOut");// 删除装车皮倒库
            PreparedStatement deleteOut = con.prepareStatement(sqldelte);
            String sqldelteXs = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLibXs.deleteOut");// 删除销售装车皮倒库
            PreparedStatement deleteOutXs = con.prepareStatement(sqldelteXs);
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdate);

            List<YdmZcOutlistEntity1> ydmout = new ArrayList<YdmZcOutlistEntity1>();
            for (int i = 0; i < pram.size(); i++) {
                ydmout.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);

                String flag = "";
                String sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryOutFlag");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                if (rs.next()) {
                    flag = rs.getString("TAR_REC_FLAG");
                }
                rs.close();
                ps.close();
                if (flag.equals("1")) {
                    core.setV_errMsg("该炉倒库记录已入库接收,不能进行此操作！");
                    return core;
                }

                deleteOut.setObject(1, billNo);
                deleteOut.setObject(2, jusNo);
                deleteOut.setObject(3, batchNo);
                deleteOut.setObject(4, groupNo);
                deleteOut.setObject(5, ordLnDlyPk);
                deleteOut.addBatch();
                
                deleteOutXs.setObject(1, billNo);
                deleteOutXs.setObject(2, jusNo);
                deleteOutXs.setObject(3, batchNo);
                deleteOutXs.setObject(4, groupNo);
                deleteOutXs.setObject(5, ordLnDlyPk);
                deleteOutXs.addBatch();

                updateBillC.setObject(1, "0");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();

            }
            deleteOut.executeBatch();
            deleteOutXs.executeBatch();
            updateBillC.executeBatch();
            core.setV_errMsg("撤销倒库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }

    /**
     *新增装车皮入库记录
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject addBillIn(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sqlquery = "";
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqlInset = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.INSERTIn");// 新增装车皮入库
            PreparedStatement insertIn = con.prepareStatement(sqlInset);
            
            String sqlInsetXs = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLibXs.INSERTIn");// 新增装车皮入库
            PreparedStatement insertInXs = con.prepareStatement(sqlInsetXs);
            
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEOut");// 修改装车皮倒库接收标志
            PreparedStatement updateOut = con.prepareStatement(sqlupdate);
            
            String sqlupdateXs = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLibXs.UPDATEOut");// 修改装车皮倒库接收标志
            PreparedStatement updateOutXs = con.prepareStatement(sqlupdateXs);
            
            String sqlupdateb = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdateb);
            List<YdmZcInlistEntity> ydmin = new ArrayList<YdmZcInlistEntity>();
            for (int i = 0; i < pram.size(); i++) {
                ydmin.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);
                String name = list.get(5);
                String time = list.get(6);
                String manageNo = list.get(7);
                String manageName = list.get(8);
                String depid = list.get(9);
                String depName = list.get(10);
                String storage = list.get(11);
                String bz = list.get(12);
                String bc = list.get(13);

                String flag = "";
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryOutFlag");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                if (rs.next()) {
                    flag = rs.getString("TAR_REC_FLAG");
                }
                rs.close();
                ps.close();
                if (flag.equals("1")) {
                    core.setV_errMsg("该炉倒库记录已入库接收,不能进行此操作！");
                    return core;
                }

                // 仓库信息
                String starrl = "";// 仓库类型
                String starrlName = "";// 类型名称
                String stoTypNo = "";// 仓库类别
                String stoTypeName = "";// 类别名称
                String lotNo = "";// 位置
                String layNo = "";// 层高
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryStorage");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, storage);
                ps.setObject(2, storage + 10101);
                rs = ps.executeQuery();
                if (rs.next()) {
                    starrl = rs.getString("STORAGE_ATTR");
                    starrlName = rs.getString("STORAGE_ATTR_NAME");
                    stoTypNo = rs.getString("STORAGE_TYPE_NO");
                    stoTypeName = rs.getString("STORAGE_TYPE_NAME");
                    lotNo = rs.getString("COL_MAX_NUM");
                    layNo = rs.getString("LAY_MAX_NUM");
                }
                ps.close();
                rs.close();

                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.qureyOutMatNo");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                ydmin = EntityTool.getEntitysByRs(rs, YdmZcInlistEntity.class);
                rs.close();
                ps.close();

                String sendIn = querySendIn(con, "800705");
                // 获取入库流水号
                String butessMatNo;
                butessMatNo = querySendInList(con, sendIn, "800705");

                int outNo = Integer.parseInt(butessMatNo.substring(butessMatNo
                        .length() - 4, butessMatNo.length()));
                for (YdmZcInlistEntity ydmouts : ydmin) {
                    insertIn.setObject(1, sendIn
                            + StringTool.formatDecimal(outNo, "0000"));
                    insertIn.setString(2, sendIn);
                    insertIn.setString(3, "800705");
                    insertIn.setString(4, "装车皮倒入");
                    insertIn.setString(5, ydmouts.getVehicleNo());
                    insertIn.setString(6, ydmouts.getMatNo());
                    insertIn.setString(7, ydmouts.getLotNo());
                    insertIn.setString(8, ydmouts.getStoveNo());
                    insertIn.setString(9, ydmouts.getJudgeStoveNo());
                    insertIn.setString(10, ydmouts.getBatchNo());
                    insertIn.setString(11, ydmouts.getBatchGroudNo());
                    insertIn.setString(12, ydmouts.getMaterialNo());
                    insertIn.setString(13, ydmouts.getMaterialName());
                    insertIn.setString(14, ydmouts.getProduccode());
                    insertIn.setString(15, ydmouts.getProducname());
                    insertIn.setString(16, ydmouts.getStdCode());
                    insertIn.setString(17, ydmouts.getStdName());
                    insertIn.setString(18, ydmouts.getGradecode());
                    insertIn.setString(19, ydmouts.getGradename());
                    insertIn.setString(20, ydmouts.getSteelcode());
                    insertIn.setString(21, ydmouts.getSteelname());
                    insertIn.setString(22, ydmouts.getStdStyle());
                    insertIn.setString(23, ydmouts.getStdStyleDesc());
                    insertIn.setString(24, ydmouts.getSpecCode());
                    insertIn.setString(25, ydmouts.getSpecName());
                    insertIn.setString(26, ydmouts.getModelCode());
                    insertIn.setString(27, ydmouts.getModelDesc());
                    insertIn.setString(28, ydmouts.getPlineCode());
                    insertIn.setString(29, ydmouts.getPlineName());
                    insertIn.setString(30, ydmouts.getActDimater());
                    insertIn.setString(31, ydmouts.getActHeight());
                    insertIn.setString(32, String.valueOf(ydmouts.getActLen()));
                    insertIn.setString(33, String.valueOf(ydmouts
                            .getActLenMin()));
                    insertIn.setString(34, String.valueOf(ydmouts
                            .getActLenMax()));
                    insertIn.setString(35, ydmouts.getActCount());
                    insertIn.setString(36, String.valueOf(ydmouts
                            .getActWeight()));
                    insertIn.setString(37, String.valueOf(ydmouts
                            .getActTheoryWeight()));
                    insertIn.setString(38, ydmouts.getBelongCode());
                    insertIn.setString(39, ydmouts.getBelongName());
                    insertIn.setString(40, storage);
                    insertIn.setString(41, storage + 10101);
                    insertIn.setString(42, layNo);
                    insertIn.setString(43, lotNo);
                    insertIn.setString(44, starrl);
                    insertIn.setString(45, starrlName);
                    insertIn.setString(46, stoTypNo);
                    insertIn.setString(47, stoTypeName);
                    insertIn.setString(48, manageNo);
                    insertIn.setString(49, manageName);
                    
                    insertInXs.setObject(1, sendIn
                            + StringTool.formatDecimal(outNo, "0000"));
                    insertInXs.setString(2, sendIn);
                    insertInXs.setString(3, "800705");
                    insertInXs.setString(4, "装车皮倒入");
                    insertInXs.setString(5, ydmouts.getVehicleNo());
                    insertInXs.setString(6, ydmouts.getMatNo());
                    insertInXs.setString(7, ydmouts.getLotNo());
                    insertInXs.setString(8, ydmouts.getStoveNo());
                    insertInXs.setString(9, ydmouts.getJudgeStoveNo());
                    insertInXs.setString(10, ydmouts.getBatchNo());
                    insertInXs.setString(11, ydmouts.getBatchGroudNo());
                    insertInXs.setString(12, ydmouts.getMaterialNo());
                    insertInXs.setString(13, ydmouts.getMaterialName());
                    insertInXs.setString(14, ydmouts.getProduccode());
                    insertInXs.setString(15, ydmouts.getProducname());
                    insertInXs.setString(16, ydmouts.getStdCode());
                    insertInXs.setString(17, ydmouts.getStdName());
                    insertInXs.setString(18, ydmouts.getGradecode());
                    insertInXs.setString(19, ydmouts.getGradename());
                    insertInXs.setString(20, ydmouts.getSteelcode());
                    insertInXs.setString(21, ydmouts.getSteelname());
                    insertInXs.setString(22, ydmouts.getStdStyle());
                    insertInXs.setString(23, ydmouts.getStdStyleDesc());
                    insertInXs.setString(24, ydmouts.getSpecCode());
                    insertInXs.setString(25, ydmouts.getSpecName());
                    insertInXs.setString(26, ydmouts.getModelCode());
                    insertInXs.setString(27, ydmouts.getModelDesc());
                    insertInXs.setString(28, ydmouts.getPlineCode());
                    insertInXs.setString(29, ydmouts.getPlineName());
                    insertInXs.setString(30, ydmouts.getActDimater());
                    insertInXs.setString(31, ydmouts.getActHeight());
                    insertInXs.setString(32, String.valueOf(ydmouts.getActLen()));
                    insertInXs.setString(33, String.valueOf(ydmouts
                            .getActLenMin()));
                    insertInXs.setString(34, String.valueOf(ydmouts
                            .getActLenMax()));
                    insertInXs.setString(35, ydmouts.getActCount());
                    insertInXs.setString(36, String.valueOf(ydmouts
                            .getActWeight()));
                    insertInXs.setString(37, String.valueOf(ydmouts
                            .getActTheoryWeight()));
                    insertInXs.setString(38, ydmouts.getBelongCode());
                    insertInXs.setString(39, ydmouts.getBelongName());
                    insertInXs.setString(40, storage);
                    insertInXs.setString(41, storage + 10101);
                    insertInXs.setString(42, layNo);
                    insertInXs.setString(43, lotNo);
                    insertInXs.setString(44, starrl);
                    insertInXs.setString(45, starrlName);
                    insertInXs.setString(46, stoTypNo);
                    insertInXs.setString(47, stoTypeName);
                    insertInXs.setString(48, manageNo);
                    insertInXs.setString(49, manageName);
                    
                    if (ydmouts.getRpoTime().equals("")) {
                        insertIn.setString(50, "");
                        insertInXs.setString(50, "");

                    }
                    else {
                        insertIn.setString(50, ydmouts.getRpoTime().substring(
                                0, 19));
                        insertInXs.setString(50, ydmouts.getRpoTime().substring(
                                0, 19));
                    }
                    insertIn.setString(51, ydmouts.getProBc());
                    insertIn.setString(52, ydmouts.getProBz());
                    insertIn.setString(53, time);
                    insertIn.setString(54, bc);// 班次
                    insertIn.setString(55, bz);// 班组
                    insertIn.setString(56, name);
                    insertIn.setString(57, time);
                    insertIn.setString(58, ydmouts.getOrdPk());
                    insertIn.setString(59, ydmouts.getOrdLnPk());
                    insertIn.setString(60, ydmouts.getOrdLnDlyPk());
                    insertIn.setString(61, depid);
                    insertIn.setString(62, depName);
                    insertIn.setString(63, ydmouts.getOrderNo());
                    insertIn.setString(64, ydmouts.getOrderSeq());
                    insertIn.setString(65, ydmouts.getDeliveryNo());
                    insertIn.setString(66, ydmouts.getProductFlag());
                    insertIn.setString(67, ydmouts.getMatStatus());
                    insertIn.setString(68, ydmouts.getJudgeStdCode());
                    insertIn.setString(69, ydmouts.getJudgeStdName());
                    insertIn.setString(70, ydmouts.getBalYearMonth());
                    insertIn.setString(71, billNo);
                    insertIn.addBatch();
                    insertInXs.setString(51, ydmouts.getProBc());
                    insertInXs.setString(52, ydmouts.getProBz());
                    insertInXs.setString(53, time);
                    insertInXs.setString(54, bc);// 班次
                    insertInXs.setString(55, bz);// 班组
                    insertInXs.setString(56, name);
                    insertInXs.setString(57, time);
                    insertInXs.setString(58, ydmouts.getOrdPk());
                    insertInXs.setString(59, ydmouts.getOrdLnPk());
                    insertInXs.setString(60, ydmouts.getOrdLnDlyPk());
                    insertInXs.setString(61, depid);
                    insertInXs.setString(62, depName);
                    insertInXs.setString(63, ydmouts.getOrderNo());
                    insertInXs.setString(64, ydmouts.getOrderSeq());
                    insertInXs.setString(65, ydmouts.getDeliveryNo());
                    insertInXs.setString(66, ydmouts.getProductFlag());
                    insertInXs.setString(67, ydmouts.getMatStatus());
                    insertInXs.setString(68, ydmouts.getJudgeStdCode());
                    insertInXs.setString(69, ydmouts.getJudgeStdName());
                    insertInXs.setString(70, ydmouts.getBalYearMonth());
                    insertInXs.setString(71, billNo);
                    insertInXs.addBatch();
                    outNo++;

                    updateOut.setObject(1, storage + 10101);
                    updateOut.setObject(2, layNo);
                    updateOut.setObject(3, lotNo);
                    updateOut.setObject(4, starrl);
                    updateOut.setObject(5, starrlName);
                    updateOut.setObject(6, stoTypNo);
                    updateOut.setObject(7, stoTypeName);
                    updateOut.setObject(8, manageNo);
                    updateOut.setObject(9, manageName);
                    updateOut.setObject(10, depid);
                    updateOut.setObject(11, depName);
                    updateOut.setObject(12, time);
                    updateOut.setObject(13, bc);
                    updateOut.setObject(14, bz);
                    updateOut.setObject(15, billNo);
                    updateOut.setObject(16, jusNo);
                    updateOut.setObject(17, batchNo);
                    updateOut.setObject(18, groupNo);
                    updateOut.setObject(19, ordLnDlyPk);
                    updateOut.addBatch();
                    updateOutXs.setObject(1, storage + 10101);
                    updateOutXs.setObject(2, layNo);
                    updateOutXs.setObject(3, lotNo);
                    updateOutXs.setObject(4, starrl);
                    updateOutXs.setObject(5, starrlName);
                    updateOutXs.setObject(6, stoTypNo);
                    updateOutXs.setObject(7, stoTypeName);
                    updateOutXs.setObject(8, manageNo);
                    updateOutXs.setObject(9, manageName);
                    updateOutXs.setObject(10, depid);
                    updateOutXs.setObject(11, depName);
                    updateOutXs.setObject(12, time);
                    updateOutXs.setObject(13, bc);
                    updateOutXs.setObject(14, bz);
                    updateOutXs.setObject(15, billNo);
                    updateOutXs.setObject(16, jusNo);
                    updateOutXs.setObject(17, batchNo);
                    updateOutXs.setObject(18, groupNo);
                    updateOutXs.setObject(19, ordLnDlyPk);
                    updateOutXs.addBatch();
                }
                insertIn.executeBatch();
                insertInXs.executeBatch();


                updateBillC.setObject(1, "2");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();
            }
            updateOut.executeBatch();
            updateOutXs.executeBatch();
            updateBillC.executeBatch();
            core.setV_errMsg("装车皮入库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }

    /**
     *撤销倒库记录
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject deleteBillIn(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqldelte = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.deleteIn");// 删除装车皮入库
            PreparedStatement deleteIn = con.prepareStatement(sqldelte);
            String sqldelteXs = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLibXs.deleteIn");// 删除装车皮销售入库
            PreparedStatement deleteInXs = con.prepareStatement(sqldelteXs);
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdate);
            String sqlupdateOut = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEOutFalg");// 修改装车皮倒库接收标志
            PreparedStatement updateOut = con.prepareStatement(sqlupdateOut);
            List<YdmZcOutlistEntity1> ydmout = new ArrayList<YdmZcOutlistEntity1>();
            for (int i = 0; i < pram.size(); i++) {
                ydmout.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);

                deleteIn.setObject(1, billNo);
                deleteIn.setObject(2, jusNo);
                deleteIn.setObject(3, batchNo);
                deleteIn.setObject(4, groupNo);
                deleteIn.setObject(5, ordLnDlyPk);
                deleteIn.addBatch();
                
                deleteInXs.setObject(1, billNo);
                deleteInXs.setObject(2, jusNo);
                deleteInXs.setObject(3, batchNo);
                deleteInXs.setObject(4, groupNo);
                deleteInXs.setObject(5, ordLnDlyPk);
                deleteInXs.addBatch();
                
                updateOut.setObject(1, billNo);
                updateOut.setObject(2, jusNo);
                updateOut.setObject(3, batchNo);
                updateOut.setObject(4, groupNo);
                updateOut.setObject(5, ordLnDlyPk);
                updateOut.addBatch();
                
                updateBillC.setObject(1, "1");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();

            }
            deleteIn.executeBatch();
            deleteInXs.executeBatch();
            updateOut.executeBatch();
            updateBillC.executeBatch();
            core.setV_errMsg("撤销入库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }
    /**
     *新增装车皮倒库记录(坯子)
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject addBillOutPz(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sqlquery = "";
        Date nowTime = new Date();
        SimpleDateFormat df = new SimpleDateFormat("yyyyMM");
        String jsTime = df.format(nowTime);
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqlInset = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.INSERTOUTPZ");// 新增装车皮倒库
            PreparedStatement insertOut = con.prepareStatement(sqlInset);
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdate);

            List<YdmZcOutlistEntity1> ydmout = new ArrayList<YdmZcOutlistEntity1>();
            for (int i = 0; i < pram.size(); i++) {
                ydmout.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);
                String name = list.get(5);
                String time = list.get(6);
                String manageNo = list.get(7);
                String manageName = list.get(8);
                String depid = list.get(9);
                String depName = list.get(10);
                String storage = list.get(11);
                String bz = list.get(12);
                String bc = list.get(13);

                String flag = "";
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryFlag");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                if (rs.next()) {
                    flag = rs.getString("MOVE_LOAD_FLAG");
                }
                rs.close();
                ps.close();
                if (!flag.equals("0")) {
                    core.setV_errMsg("该炉不是未进行装车皮倒库状态,不能进行此操作！");
                    return core;
                }

                // 仓库信息
                String starrl = "";// 仓库类型
                String starrlName = "";// 类型名称
                String stoTypNo = "";// 仓库类别
                String stoTypeName = "";// 类别名称
                String lotNo = "";// 位置
                String layNo = "";// 层高
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryStorage");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, storage);
                ps.setObject(2, storage + 10101);
                rs = ps.executeQuery();
                if (rs.next()) {
                    starrl = rs.getString("STORAGE_ATTR");
                    starrlName = rs.getString("STORAGE_ATTR_NAME");
                    stoTypNo = rs.getString("STORAGE_TYPE_NO");
                    stoTypeName = rs.getString("STORAGE_TYPE_NAME");
                    lotNo = rs.getString("COL_MAX_NUM");
                    layNo = rs.getString("LAY_MAX_NUM");
                }
                ps.close();
                rs.close();

                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.qureyBillC");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, ordLnDlyPk);
                ps.setObject(3, jusNo);
                ps.setObject(4, batchNo);
                ps.setObject(5, groupNo);
                rs = ps.executeQuery();
                ydmout = EntityTool.getEntitysByRs(rs,
                        YdmZcOutlistEntity1.class);
                rs.close();
                ps.close();

                String sendOut = querySendOutPZ(con, "800807");
                // 获取出库流水号
                String butessMatNo;
                butessMatNo = querySendOutListPz(con, sendOut, "800807");

                int outNo = Integer.parseInt(butessMatNo.substring(butessMatNo
                        .length() - 4, butessMatNo.length()));
                for (YdmZcOutlistEntity1 ydmouts : ydmout) {
                    insertOut.setObject(1, sendOut
                            + StringTool.formatDecimal(outNo, "0000"));
                    insertOut.setString(2, sendOut);
                    insertOut.setString(3, "800807");
                    insertOut.setString(4, "装车皮倒出");
                    insertOut.setString(5, "");
                    insertOut.setString(6, ydmouts.getMatNo());
                    insertOut.setString(7, ydmouts.getLotNo());
                    insertOut.setString(8, ydmouts.getStoveNo());
                    insertOut.setString(9, ydmouts.getJudgeStoveNo());
                    insertOut.setString(10, ydmouts.getBatchNo());
                    insertOut.setString(11, ydmouts.getBatchGroudNo());
                    insertOut.setString(12, ydmouts.getMaterialNo());
                    insertOut.setString(13, ydmouts.getMaterialName());
                    insertOut.setString(14, ydmouts.getProduccode());
                    insertOut.setString(15, ydmouts.getProducname());
                    insertOut.setString(16, ydmouts.getStdCode());
                    insertOut.setString(17, ydmouts.getStdName());
                    insertOut.setString(18, ydmouts.getGradecode());
                    insertOut.setString(19, ydmouts.getGradename());
                    insertOut.setString(20, ydmouts.getSpecCode());
                    insertOut.setString(21, ydmouts.getSpecName());
                    insertOut.setString(22, ydmouts.getPlineCode());
                    insertOut.setString(23, ydmouts.getPlineName());
                    insertOut.setString(24, ydmouts.getActDimater());
                    insertOut.setString(25, ydmouts.getActHeight());
                    insertOut
                            .setString(26, String.valueOf(ydmouts.getActLen()));
                    insertOut.setString(27, String.valueOf(ydmouts
                            .getActLenMin()));
                    insertOut.setString(28, String.valueOf(ydmouts
                            .getActLenMax()));
                    insertOut.setString(29, ydmouts.getActCount());
                    insertOut.setString(30, String.valueOf(ydmouts
                            .getActWeight()));
                    insertOut.setString(31, String.valueOf(ydmouts
                            .getActTheoryWeight()));
                    insertOut.setString(32, ydmouts.getStorageNo());
                    insertOut.setString(33, ydmouts.getLocationNo());
                    insertOut.setString(34, layNo);
                    insertOut.setString(35, lotNo);
                    insertOut.setString(36, starrl);
                    insertOut.setString(37, starrlName);
                    insertOut.setString(38, stoTypNo);
                    insertOut.setString(39, stoTypeName);
                    insertOut.setString(40, manageNo);
                    insertOut.setString(41, manageName);
                    if (ydmouts.getRpoTime().equals("")) {
                        insertOut.setString(42, "");
                    }
                    else {
                        insertOut.setString(42, ydmouts.getRpoTime().substring(
                                0, 19));
                    }
                    insertOut.setString(43, ydmouts.getProBc());
                    insertOut.setString(44, ydmouts.getProBz());
                    insertOut.setString(45, time);
                    insertOut.setString(46, bc);// 班次
                    insertOut.setString(47, bz);// 班组
                    insertOut.setString(48, name);
                    insertOut.setString(49, time);
                    insertOut.setString(50, ydmouts.getOrdPk());
                    insertOut.setString(51, ydmouts.getOrdLnPk());
                    insertOut.setString(52, ydmouts.getOrdLnDlyPk());
                    insertOut.setString(53, ydmouts.getOrderNo());
                    insertOut.setString(54, ydmouts.getOrderSeq());
                    insertOut.setString(55, ydmouts.getDeliveryNo());
                    insertOut.setString(56, depid);
                    insertOut.setString(57, depName);
                    insertOut.setString(58, ydmouts.getBelongCode());
                    insertOut.setString(59, ydmouts.getBelongName());
                    insertOut.setString(60, jsTime);
                    insertOut.setString(61, "801403");
                    insertOut.setString(62, "80150302");
                    insertOut.setString(63, billNo);
                    insertOut.setString(64, ydmouts.getVstel());
                    insertOut.setString(65, String.valueOf(ydmouts.getActFixNum()));
                    insertOut.setString(66, String.valueOf(ydmouts.getActFixLen()));
                    insertOut.addBatch();
                    outNo++;
                }
                insertOut.executeBatch();
                
                updateBillC.setObject(1, "1");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();

            }
            updateBillC.executeBatch();
            core.setV_errMsg("装车皮倒库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }
    /**
     *撤销倒库记录（坯子）
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject deleteBillOutPZ(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqldelte = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.deleteOutPz");// 删除装车皮倒库
            PreparedStatement deleteOut = con.prepareStatement(sqldelte);
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdate);

            List<YdmZcOutlistEntity1> ydmout = new ArrayList<YdmZcOutlistEntity1>();
            for (int i = 0; i < pram.size(); i++) {
                ydmout.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);

                String flag = "";
                String sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryOutFlagPZ");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                if (rs.next()) {
                    flag = rs.getString("TAR_REC_FLAG");
                }
                rs.close();
                ps.close();
                if (flag.equals("1")) {
                    core.setV_errMsg("该炉倒库记录已入库接收,不能进行此操作！");
                    return core;
                }

                deleteOut.setObject(1, billNo);
                deleteOut.setObject(2, jusNo);
                deleteOut.setObject(3, batchNo);
                deleteOut.setObject(4, groupNo);
                deleteOut.setObject(5, ordLnDlyPk);
                deleteOut.addBatch();

                updateBillC.setObject(1, "0");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();

            }
            deleteOut.executeBatch();
            updateBillC.executeBatch();
            core.setV_errMsg("撤销倒库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }
    /**
     *新增装车皮入库记录(坯子)
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject addBillInPz(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        String sqlquery = "";
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqlInset = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.INSERTInPz");// 新增装车皮入库
            PreparedStatement insertIn = con.prepareStatement(sqlInset);
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEOutPZ");// 修改装车皮倒库接收标志
            PreparedStatement updateOut = con.prepareStatement(sqlupdate);
            String sqlupdateb = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdateb);
            List<YdmZcInlistEntity> ydmin = new ArrayList<YdmZcInlistEntity>();
            for (int i = 0; i < pram.size(); i++) {
                ydmin.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);
                String name = list.get(5);
                String time = list.get(6);
                String manageNo = list.get(7);
                String manageName = list.get(8);
                String depid = list.get(9);
                String depName = list.get(10);
                String storage = list.get(11);
                String bz = list.get(12);
                String bc = list.get(13);

                String flag = "";
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryOutFlagPZ");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                if (rs.next()) {
                    flag = rs.getString("TAR_REC_FLAG");
                }
                rs.close();
                ps.close();
                if (flag.equals("1")) {
                    core.setV_errMsg("该炉倒库记录已入库接收,不能进行此操作！");
                    return core;
                }

                // 仓库信息
                String starrl = "";// 仓库类型
                String starrlName = "";// 类型名称
                String stoTypNo = "";// 仓库类别
                String stoTypeName = "";// 类别名称
                String lotNo = "";// 位置
                String layNo = "";// 层高
                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.queryStorage");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, storage);
                ps.setObject(2, storage + 10101);
                rs = ps.executeQuery();
                if (rs.next()) {
                    starrl = rs.getString("STORAGE_ATTR");
                    starrlName = rs.getString("STORAGE_ATTR_NAME");
                    stoTypNo = rs.getString("STORAGE_TYPE_NO");
                    stoTypeName = rs.getString("STORAGE_TYPE_NAME");
                    lotNo = rs.getString("COL_MAX_NUM");
                    layNo = rs.getString("LAY_MAX_NUM");
                }
                ps.close();
                rs.close();

                sqlquery = CoreXmlSqlParsersFactory
                        .getSql("FrmPuorLib.qureyOutMatNoPz");
                ps = con.prepareStatement(sqlquery);
                ps.setObject(1, billNo);
                ps.setObject(2, jusNo);
                ps.setObject(3, batchNo);
                ps.setObject(4, groupNo);
                ps.setObject(5, ordLnDlyPk);
                rs = ps.executeQuery();
                ydmin = EntityTool.getEntitysByRs(rs, YdmZcInlistEntity.class);
                rs.close();
                ps.close();

                String sendIn = querySendInPZ(con, "800705");
                // 获取入库流水号
                String butessMatNo;
                butessMatNo = querySendInListPz(con, sendIn, "800705");

                int outNo = Integer.parseInt(butessMatNo.substring(butessMatNo
                        .length() - 4, butessMatNo.length()));
                for (YdmZcInlistEntity ydmouts : ydmin) {
                    insertIn.setObject(1, sendIn
                            + StringTool.formatDecimal(outNo, "0000"));
                    insertIn.setString(2, sendIn);
                    insertIn.setString(3, "800705");
                    insertIn.setString(4, "装车皮倒入");
                    insertIn.setString(5, ydmouts.getVehicleNo());
                    insertIn.setString(6, ydmouts.getMatNo());
                    insertIn.setString(7, ydmouts.getLotNo());
                    insertIn.setString(8, ydmouts.getStoveNo());
                    insertIn.setString(9, ydmouts.getJudgeStoveNo());
                    insertIn.setString(10, ydmouts.getBatchNo());
                    insertIn.setString(11, ydmouts.getBatchGroudNo());
                    insertIn.setString(12, ydmouts.getMaterialNo());
                    insertIn.setString(13, ydmouts.getMaterialName());
                    insertIn.setString(14, ydmouts.getProduccode());
                    insertIn.setString(15, ydmouts.getProducname());
                    insertIn.setString(16, ydmouts.getStdCode());
                    insertIn.setString(17, ydmouts.getStdName());
                    insertIn.setString(18, ydmouts.getGradecode());
                    insertIn.setString(19, ydmouts.getGradename());
                    insertIn.setString(20, ydmouts.getSpecCode());
                    insertIn.setString(21, ydmouts.getSpecName());
                    insertIn.setString(22, ydmouts.getPlineCode());
                    insertIn.setString(23, ydmouts.getPlineName());
                    insertIn.setString(24, ydmouts.getActDimater());
                    insertIn.setString(25, ydmouts.getActHeight());
                    insertIn.setString(26, String.valueOf(ydmouts.getActLen()));
                    insertIn.setString(27, String.valueOf(ydmouts
                            .getActLenMin()));
                    insertIn.setString(28, String.valueOf(ydmouts
                            .getActLenMax()));
                    insertIn.setString(29, ydmouts.getActCount());
                    insertIn.setString(30, String.valueOf(ydmouts
                            .getActWeight()));
                    insertIn.setString(31, String.valueOf(ydmouts
                            .getActTheoryWeight()));
                    insertIn.setString(32, ydmouts.getBelongCode());
                    insertIn.setString(33, ydmouts.getBelongName());
                    insertIn.setString(34, storage);
                    insertIn.setString(35, storage + 10101);
                    insertIn.setString(36, layNo);
                    insertIn.setString(37, lotNo);
                    insertIn.setString(38, starrl);
                    insertIn.setString(39, starrlName);
                    insertIn.setString(40, stoTypNo);
                    insertIn.setString(41, stoTypeName);
                    insertIn.setString(42, manageNo);
                    insertIn.setString(43, manageName);
                    if (ydmouts.getRpoTime().equals("")) {
                        insertIn.setString(44, "");
                    }
                    else {
                        insertIn.setString(44, ydmouts.getRpoTime().substring(
                                0, 19));
                    }
                    insertIn.setString(45, ydmouts.getProBc());
                    insertIn.setString(46, ydmouts.getProBz());
                    insertIn.setString(47, time);
                    insertIn.setString(48, bc);// 班次
                    insertIn.setString(49, bz);// 班组
                    insertIn.setString(50, name);
                    insertIn.setString(51, time);
                    insertIn.setString(52, ydmouts.getOrdPk());
                    insertIn.setString(53, ydmouts.getOrdLnPk());
                    insertIn.setString(54, ydmouts.getOrdLnDlyPk());
                    insertIn.setString(55, depid);
                    insertIn.setString(56, depName);
                    insertIn.setString(57, ydmouts.getOrderNo());
                    insertIn.setString(58, ydmouts.getOrderSeq());
                    insertIn.setString(59, ydmouts.getDeliveryNo());
                    insertIn.setString(60, ydmouts.getProductFlag());
                    insertIn.setString(61, ydmouts.getMatStatus());
                    insertIn.setString(62, ydmouts.getBalYearMonth());
                    insertIn.setString(63, billNo);
                    insertIn.setString(64, String.valueOf(ydmouts.getActFixNum()));
                    insertIn.setString(65, String.valueOf(ydmouts.getActFixLen()));
                    insertIn.addBatch();
                    outNo++;

                    updateOut.setObject(1, storage + 10101);
                    updateOut.setObject(2, layNo);
                    updateOut.setObject(3, lotNo);                 
                    updateOut.setObject(4, manageNo);
                    updateOut.setObject(5, manageName);
                    updateOut.setObject(6, depid);
                    updateOut.setObject(7, depName);
                    updateOut.setObject(8, time);
                    updateOut.setObject(9, bc);
                    updateOut.setObject(10, bz);
                    updateOut.setObject(11, billNo);
                    updateOut.setObject(12, jusNo);
                    updateOut.setObject(13, batchNo);
                    updateOut.setObject(14, groupNo);
                    updateOut.setObject(15, ordLnDlyPk);
                    updateOut.addBatch();
                }
                insertIn.executeBatch();

                updateBillC.setObject(1, "2");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();
            }
            updateOut.executeBatch();
            updateBillC.executeBatch();
            core.setV_errMsg("装车皮入库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }/**
     *撤销倒库记录（坯子）
     * @param pram 参数
     * @return obj
     */
    @SuppressWarnings("unchecked")
    public CoreReturnObject deleteBillInPz(ArrayList<Object> pram) {
        CoreReturnObject core = new CoreReturnObject();
        Connection con = null;
        try {
            con = this.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);// 取消自动提交事务
            String sqldelte = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.deleteInPz");// 删除装车皮入库
            PreparedStatement deleteIn = con.prepareStatement(sqldelte);
            String sqlupdate = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEBILLC");// 修改提单装车皮倒库标志
            PreparedStatement updateBillC = con.prepareStatement(sqlupdate);
            String sqlupdateOut = CoreXmlSqlParsersFactory
                    .getSql("FrmPuorLib.UPDATEOutFalgPz");// 修改装车皮倒库接收标志
            PreparedStatement updateOut = con.prepareStatement(sqlupdateOut);
            List<YdmZcOutlistEntity1> ydmout = new ArrayList<YdmZcOutlistEntity1>();
            for (int i = 0; i < pram.size(); i++) {
                ydmout.clear();
                ArrayList<String> list = (ArrayList<String>) pram.get(i);
                String billNo = list.get(0);
                String ordLnDlyPk = list.get(1);
                String jusNo = list.get(2);
                String batchNo = list.get(3);
                String groupNo = list.get(4);

                deleteIn.setObject(1, billNo);
                deleteIn.setObject(2, jusNo);
                deleteIn.setObject(3, batchNo);
                deleteIn.setObject(4, groupNo);
                deleteIn.setObject(5, ordLnDlyPk);
                deleteIn.addBatch();
                
                updateOut.setObject(1, billNo);
                updateOut.setObject(2, jusNo);
                updateOut.setObject(3, batchNo);
                updateOut.setObject(4, groupNo);
                updateOut.setObject(5, ordLnDlyPk);
                updateOut.addBatch();
                
                updateBillC.setObject(1, "1");
                updateBillC.setObject(2, billNo);
                updateBillC.setObject(3, ordLnDlyPk);
                updateBillC.setObject(4, jusNo);
                updateBillC.setObject(5, batchNo);
                updateBillC.setObject(6, groupNo);
                updateBillC.addBatch();

            }
            deleteIn.executeBatch();
            updateOut.executeBatch();
            updateBillC.executeBatch();
            core.setV_errMsg("撤销入库成功！");
            con.commit();
        }
        catch (Exception e) {
            core.setV_errMsg(e.getMessage());
            core.setV_errCode(-1);
            if (con != null) {
                try {
                    con.rollback(); // 回滚事务
                }
                catch (Exception e2) {
                }
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (Exception e2) {
            }
        }
        return core;
    }
}
