package com.steering.jobface.sale;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.TimerTask;

import CoreFS.SA08.CoreXmlSqlParsersFactory;
import CoreFS.SC01.CoreConstantData;

import com.steering.comm.db.DBCommon;

/**
 * 无效监制信息的清除
 * @author Administrator
 */
public class CoreOrderLinePrdcrClearTask extends TimerTask {

    public void run() {
        DBCommon db = new DBCommon();
        Connection con = null;
        try {
            con = db.getDao(CoreConstantData.sysbeanstr).getConnection();
            con.setAutoCommit(false);
            String sql = CoreXmlSqlParsersFactory
                    .getSql("CoreOrderLinePrdcrClearTask.DeletePrdcrLstNo");
            String sql1 = CoreXmlSqlParsersFactory
                    .getSql("CoreOrderLinePrdcrClearTask.DeletePrdcrNo");
            PreparedStatement ps = con.prepareStatement(sql);
            ps.executeUpdate();
            ps.close();
            ps = con.prepareStatement(sql1);
            ps.executeUpdate();
            ps.close();
            con.commit();
        }
        catch (SQLException e) {
            try {
                if (con != null && !con.isClosed()) {
                    con.rollback();
                }
                e.printStackTrace();
            }
            catch (SQLException e1) {
                e1.printStackTrace();
            }
        }
        finally {
            try {
                if (con != null && !con.isClosed()) {
                    con.close();
                }
            }
            catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

}
