⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 goodsimportinfo.java

📁 用jsp,java写的在线购物系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   GoodsImportInfo.java

package mediastore.dao;

import java.io.PrintStream;
import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import mediastore.common.DBConnection;
import mediastore.rule.ImportBillSearchRule;
import mediastore.util.StrUtility;
import mediastore.web.form.*;

// Referenced classes of package mediastore.dao:
//            GoodsImportGoods, GoodsInfo

public class GoodsImportInfo
{

    public GoodsImportInfo()
    {
    }

    public int getMaxBillIDNum()
    {
        int maxInTabGoodsImportInfo;
        int minInTabGoodsImportGoods;
        int nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        maxInTabGoodsImportInfo = 0;
        minInTabGoodsImportGoods = 0;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "SELECT max(BillID) FROM TabGoodsImportInfo ";
            rs = stmt.executeQuery(strSQL);
            if(!rs.next())
            {
                nRet = -1;
                throw new Exception("获得最大进货单号失败");
            }
            maxInTabGoodsImportInfo = rs.getInt(1);
            rs.close();
            rs = null;
            strSQL = "SELECT min(BillID) FROM TabGoodsImportGoods WHERE ConfirmFlage='0'";
            rs = stmt.executeQuery(strSQL);
            if(!rs.next())
                minInTabGoodsImportGoods = 0;
            else
                minInTabGoodsImportGoods = rs.getInt(1);
            rs.close();
            rs = null;
        }
        catch(Exception exception) { }
        finally
        {
            try
            {
                if(rs != null)
                    rs.close();
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        if(minInTabGoodsImportGoods == 0)
            return maxInTabGoodsImportInfo;
        if(maxInTabGoodsImportInfo < minInTabGoodsImportGoods)
            return maxInTabGoodsImportInfo;
        if(maxInTabGoodsImportInfo > minInTabGoodsImportGoods)
            return minInTabGoodsImportGoods - 1;
        else
            return 0;
    }

    public int insertNewBillRec(int billId, String sendPersons, String InceptPerson, float totalPrice, String payOrNot)
    {
        int nRet;
        nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            conn.setAutoCommit(false);
            stmt = conn.createStatement();
            if(payOrNot.trim().equals("1"))
                strSQL = "insert into TabGoodsImportInfo( BillID, SendPersons, InceptPersons, TotalPrice, ImportTime, PaymentTime) values (" + billId + ", '" + StrUtility.replaceString(sendPersons, "'", "''") + "', '" + StrUtility.replaceString(InceptPerson, "'", "''") + "', " + totalPrice + ", getdate(), getdate())";
            else
                strSQL = "insert into TabGoodsImportInfo( BillID, SendPersons, InceptPersons, TotalPrice, ImportTime) values (" + billId + ", '" + StrUtility.replaceString(sendPersons, "'", "''") + "', '" + StrUtility.replaceString(InceptPerson, "'", "''") + "', " + totalPrice + ", getdate())";
            nRet = stmt.executeUpdate(strSQL);
            if(nRet != 1)
            {
                nRet = -1;
                throw new Exception("插入新记录错误");
            }
            conn.commit();
        }
        catch(Exception e)
        {
            nRet = -1;
        }
        finally
        {
            try
            {
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException ex) { }
        }
        return nRet;
    }

    public List getBillIdList()
    {
        List billIdList;
        billIdList = new ArrayList();
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "SELECT DISTINCT BillID FROM TabGoodsImportInfo Order by BillID";
            String billIdStr;
            for(rs = stmt.executeQuery(strSQL); rs.next(); billIdList.add(billIdStr))
                billIdStr = String.valueOf(rs.getInt(1));

            rs.close();
            rs = null;
        }
        catch(Exception exception) { }
        finally
        {
            try
            {
                if(rs != null)
                    rs.close();
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return billIdList;
    }

    public List getSendPersonsList()
    {
        List sendPersonsList;
        sendPersonsList = new ArrayList();
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "SELECT DISTINCT SendPersons FROM TabGoodsImportInfo Order by SendPersons";
            String curSendPersons;
            for(rs = stmt.executeQuery(strSQL); rs.next(); sendPersonsList.add(curSendPersons))
                curSendPersons = rs.getString(1);

            rs.close();
            rs = null;
        }
        catch(Exception exception) { }
        finally
        {
            try
            {
                if(rs != null)
                    rs.close();
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return sendPersonsList;
    }

    public List getInceptPersonsList()
    {
        List inceptPersonsList;
        inceptPersonsList = new ArrayList();
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "SELECT DISTINCT InceptPersons FROM TabGoodsImportInfo Order by InceptPersons";
            String curSendPersons;
            for(rs = stmt.executeQuery(strSQL); rs.next(); inceptPersonsList.add(curSendPersons))
                curSendPersons = rs.getString(1);

            rs.close();
            rs = null;
        }
        catch(Exception exception) { }
        finally
        {
            try
            {
                if(rs != null)
                    rs.close();
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return inceptPersonsList;
    }

    public ImportBillSearchResultInfo getBillListByRule(ImportBillSearchRule ibsr)
    {
        int totalRecNum;
        List importBillList;
        ImportBillSearchResultInfo ibsri;
        int nRet = 0;
        totalRecNum = 0;
        importBillList = new ArrayList();
        ibsri = new ImportBillSearchResultInfo();
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        String strSQLForCount = null;
        int startRecNum = ibsr.getStartRecNum();
        int recNumOfPage = ibsr.getRecNumOfPage();
        String orderStr = ibsr.getOrderStr();
        int billId = ibsr.getBillId();
        String sendPersons = ibsr.getSendPersons();
        String inceptPersons = ibsr.getInceptPersons();
        String importTime1 = ibsr.getImportTime1();
        String importTime2 = ibsr.getImportTime2();
        String paymentTime1 = ibsr.getPaymentTime1();
        String paymentTime2 = ibsr.getPaymentTime2();
        System.out.println("getBillListByRule:Location_1");
        strSQL = " SELECT * FROM TabGoodsImportInfo ";
        strSQLForCount = " SELECT count(*) FROM TabGoodsImportInfo ";
        String whereStr = "";
        if(billId != 0)
            whereStr = whereStr + " BillID=" + billId + "  AND ";
        if(!sendPersons.equals("0"))
            whereStr = whereStr + " SendPersons LIKE '%" + StrUtility.replaceString(sendPersons, "'", "''") + "%'  AND ";
        if(!inceptPersons.equals("0"))
            whereStr = whereStr + " InceptPersons LIKE '%" + StrUtility.replaceString(inceptPersons, "'", "''") + "%'  AND ";
        whereStr = whereStr + " ImportTime >= '" + importTime1 + "'  AND ";
        whereStr = whereStr + " ImportTime <='" + importTime2 + "'  AND ";
        if(!paymentTime1.equals(""))
            whereStr = whereStr + " PaymentTime>= '" + paymentTime1 + "'  AND ";
        if(!paymentTime2.equals(""))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -