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

📄 goodsexportgoods.java

📁 用jsp,java写的在线购物系统
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
// 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:   GoodsExportGoods.java

package mediastore.dao;

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

// Referenced classes of package mediastore.dao:
//            GoodsInfo, RepertoryGoodsPriceCurve, GoodsExportInfo, MemberInfoDAO

public class GoodsExportGoods
{

    public GoodsExportGoods()
    {
    }

    public List getGoodsList(int billId)
    {
        List goodsList;
        GoodsInfo gi = new GoodsInfo();
        goodsList = 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 * FROM TabGoodsExportGoods WHERE BillID=" + billId + " Order by CreateTime";
            GoodsExportGoodsInfo gegi;
            for(rs = stmt.executeQuery(strSQL); rs.next(); goodsList.add(gegi))
            {
                gegi = new GoodsExportGoodsInfo();
                gegi.setBillId(rs.getInt(1));
                gegi.setGoodsId(rs.getString(2));
                gegi.setGoodsName(rs.getString(3));
                gegi.setExportAmount(rs.getInt(4));
                String nameAndPrice[] = gi.getGoodsNandPUandSU(rs.getString(2));
                float exportUnitPrice = 0.0F;
                if(Float.parseFloat(nameAndPrice[2]) > 0.0F && Float.parseFloat(nameAndPrice[2]) < Float.parseFloat(nameAndPrice[1]))
                    exportUnitPrice = Float.parseFloat(nameAndPrice[2]);
                else
                    exportUnitPrice = Float.parseFloat(nameAndPrice[1]);
                if(exportUnitPrice != rs.getFloat(5))
                    updateExportUP(rs.getInt(1), rs.getString(2), exportUnitPrice);
                gegi.setExportUnitPrice(exportUnitPrice);
                gegi.setSalesPerson(rs.getString(6));
                gegi.setCreateTime(rs.getString(7));
                gegi.setConfirmFlage(rs.getString(8));
                gegi.setMemberId(rs.getInt(9));
                gegi.setCurRepertoryAmount(gi.getRepertoryAmount(rs.getString(2)));
                if(rs.getFloat(5) < gi.getPurchaseUnitPrice(rs.getString(2)) && rs.getFloat(5) > 0.0F)
                    gegi.setIsSpecialUnitPrice("1");
                else
                    gegi.setIsSpecialUnitPrice("0");
            }

            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 goodsList;
    }

    public int insertNewGoodsRec(int billId, String goodsId, String goodsName, String salesPerson, float exportUnitPrice)
    {
        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();
            strSQL = "insert into TabGoodsExportGoods( BillID, GoodsID, GoodsName, ExportAmount, ExportUnitPrice, SalesPerson, CreateTime, ConfirmFlage, MemberId) values (" + billId + ", '" + StrUtility.replaceString(goodsId, "'", "''") + "', '" + StrUtility.replaceString(goodsName, "'", "''") + "', 1, " + exportUnitPrice + ", '" + StrUtility.replaceString(salesPerson, "'", "''") + "', getdate(), '0', 0)";
            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 int updateExportAmount(int billId, String goodsId, int exportAmount)
    {
        int nRet;
        nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "UPDATE TabGoodsExportGoods SET ExportAmount = " + exportAmount + " WHERE BillID = " + billId + " and GoodsID='" + StrUtility.replaceString(goodsId, "'", "''") + "'";
            stmt.executeUpdate(strSQL);
        }
        catch(Exception e)
        {
            nRet = -1;
        }
        finally
        {
            try
            {
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return nRet;
    }

    public int updateExportUP(int billId, String goodsId, float exportUP)
    {
        int nRet;
        nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "UPDATE TabGoodsExportGoods SET ExportUnitPrice = " + exportUP + " WHERE BillID = " + billId + " and GoodsID='" + StrUtility.replaceString(goodsId, "'", "''") + "'";
            stmt.executeUpdate(strSQL);
        }
        catch(Exception e)
        {
            nRet = -1;
        }
        finally
        {
            try
            {
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return nRet;
    }

    public String getSalesPerson(int billId, String goodsId)
    {
        String salesPerson;
        salesPerson = "";
        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 SalesPerson FROM TabGoodsExportGoods WHERE BillID=" + billId + " AND GoodsID='" + StrUtility.replaceString(goodsId, "'", "''") + "' ";
            rs = stmt.executeQuery(strSQL);
            if(rs.next())
                salesPerson = 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 salesPerson;
    }

    public int deleteGoodsRec(int billId, String goodsId)
    {
        int nRet;
        nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            String strSQL = "DELETE FROM TabGoodsExportGoods WHERE BillID=" + billId + " and GoodsID='" + StrUtility.replaceString(goodsId, "'", "''") + "'";
            stmt = conn.createStatement();
            nRet = stmt.executeUpdate(strSQL);
            if(nRet != 1)
                nRet = -1;
        }
        catch(Exception e)
        {
            e.printStackTrace();
            nRet = -1;
        }
        finally
        {
            try
            {
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return nRet;
    }

    public int updateMemberId(int billId, int memberId)
    {
        int nRet;
        nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "UPDATE TabGoodsExportGoods SET MemberId = " + memberId + " WHERE BillID = " + billId;
            stmt.executeUpdate(strSQL);
        }
        catch(Exception e)
        {
            nRet = -1;
        }
        finally
        {
            try
            {
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return nRet;
    }

    public int updateConfirmFlageToOne(int billId)
    {
        int nRet;
        nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        String strSQL = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            stmt = conn.createStatement();
            strSQL = "UPDATE TabGoodsExportGoods SET ConfirmFlage = '1' WHERE BillID = " + billId;
            stmt.executeUpdate(strSQL);
        }
        catch(Exception e)
        {
            nRet = -1;
        }
        finally
        {
            try
            {
                if(stmt != null)
                    stmt.close();
                if(conn != null)
                    dbc.closeDBConnection(conn);
            }
            catch(SQLException e) { }
        }
        return nRet;
    }

    public int deleteAllGoods(int billId)
    {
        int nRet;
        nRet = 0;
        DBConnection dbc = null;
        Connection conn = null;
        Statement stmt = null;
        try
        {
            dbc = new DBConnection();
            conn = dbc.getDBConnection();
            String strSQL = "DELETE FROM TabGoodsExportGoods WHERE BillID=" + billId + " ";
            stmt = conn.createStatement();

⌨️ 快捷键说明

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