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

📄 goodsexportinfo.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:   GoodsExportInfo.java

package mediastore.dao;

import java.sql.*;
import java.util.ArrayList;
import java.util.List;
import mediastore.common.DBConnection;
import mediastore.rule.ExportBillSearchRule;
import mediastore.util.StrUtility;
import mediastore.web.form.ExportBillSearchResultInfo;
import mediastore.web.form.GoodsExportBillInfo;

public class GoodsExportInfo
{

    public GoodsExportInfo()
    {
    }

    public int getMaxBillIDNum()
    {
        int maxInTabGoodsExportInfo;
        int minInTabGoodsExportGoods;
        int nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        maxInTabGoodsExportInfo = 0;
        minInTabGoodsExportGoods = 0;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "SELECT max(BillID) FROM TabGoodsExportInfo ";
            rs = stmt.executeQuery(strSQL);
            if(!rs.next())
            {
                nRet = -1;
                throw new Exception("获得最大售货单号失败");
            }
            maxInTabGoodsExportInfo = rs.getInt(1);
            rs.close();
            rs = null;
            strSQL = "SELECT min(BillID) FROM TabGoodsExportGoods WHERE ConfirmFlage='0'";
            rs = stmt.executeQuery(strSQL);
            if(!rs.next())
                minInTabGoodsExportGoods = 0;
            else
                minInTabGoodsExportGoods = 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(minInTabGoodsExportGoods == 0)
            return maxInTabGoodsExportInfo;
        if(maxInTabGoodsExportInfo < minInTabGoodsExportGoods)
            return maxInTabGoodsExportInfo;
        if(maxInTabGoodsExportInfo > minInTabGoodsExportGoods)
            return minInTabGoodsExportGoods - 1;
        else
            return 0;
    }

    public int insertNewBillRec(int billId, int memberId, String salesPersons, float totalPrice, float discount, float totalDisPrice, 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 TabGoodsExportInfo( BillID, MemberId, SalesPersons, TotalPrice, Discount, TotalDisPrice, ExportTime, PaymentTime) values (" + billId + ", " + memberId + ", '" + StrUtility.replaceString(salesPersons, "'", "''") + "', " + totalPrice + ", " + discount + ", " + totalDisPrice + ", getdate(), getdate())";
            else
                strSQL = "insert into TabGoodsExportInfo( BillID, MemberId, SalesPersons, TotalPrice, Discount, TotalDisPrice, ExportTime) values (" + billId + ", " + memberId + ", '" + StrUtility.replaceString(salesPersons, "'", "''") + "', " + totalPrice + ", " + discount + ", " + totalDisPrice + ", 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 TabGoodsExportInfo 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 getMemberIdList()
    {
        List memberIdList;
        memberIdList = 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 MemberId FROM TabGoodsExportInfo Order by MemberId";
            int curMemberId;
            for(rs = stmt.executeQuery(strSQL); rs.next(); memberIdList.add(String.valueOf(curMemberId)))
                curMemberId = 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 memberIdList;
    }

    public List getSalesPersonsList()
    {
        List salesPersonsList;
        salesPersonsList = 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 SalesPersons FROM TabGoodsExportInfo Order by SalesPersons";
            String curSalesPersons;
            for(rs = stmt.executeQuery(strSQL); rs.next(); salesPersonsList.add(curSalesPersons))
                curSalesPersons = 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 salesPersonsList;
    }

    public ExportBillSearchResultInfo getBillListByRule(ExportBillSearchRule ebsr)
    {
        int totalRecNum;
        List exportBillList;
        ExportBillSearchResultInfo ebsri;
        int nRet = 0;
        totalRecNum = 0;
        exportBillList = new ArrayList();
        ebsri = new ExportBillSearchResultInfo();
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;
        String strSQL = null;
        String strSQLForCount = null;
        int startRecNum = ebsr.getStartRecNum();
        int recNumOfPage = ebsr.getRecNumOfPage();
        String orderStr = ebsr.getOrderStr();
        int billId = ebsr.getBillId();
        int memberId = ebsr.getMemberId();
        String salesPersons = ebsr.getSalesPersons();
        String exportTime1 = ebsr.getExportTime1();
        String exportTime2 = ebsr.getExportTime2();
        String paymentTime1 = ebsr.getPaymentTime1();
        String paymentTime2 = ebsr.getPaymentTime2();
        strSQL = " SELECT * FROM TabGoodsExportInfo ";

⌨️ 快捷键说明

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