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

📄 put_out_depot.java

📁 基于java的超市购物进销存管理系统 java 超市进销存
💻 JAVA
📖 第 1 页 / 共 2 页
字号:


    public void InOut_Enter(String inout) {
        Vector select1 = new Vector();
        select1 = Select_Means.Select_sort2(jTextField2.getText());
        if (select1.size() == 0) {
            JOptionPane.showMessageDialog(this, "商品不存在", "错误",
                                          JOptionPane.ERROR_MESSAGE);
            return;
        }
        //处理数据
        Vector insertData = new Vector();

        int i = 0;
        while (i < vector1.size()) {
            insertData = (Vector) vector1.get(i);
            Integer num1 = new Integer(insertData.get(1).toString());
            Double num2 = new Double(insertData.get(2).toString());
            if(inout.equals("1")){
                UpdateData.in_StockPile(num1,insertData.get(0).toString());
            }
            if(inout.equals("0")){
                 UpdateData.out_StockPile(num1,insertData.get(0).toString());
             }

            int j = Insert_stock.Insert_EnterStock(insertData.get(0).toString(),
                    num1, num2, insertData.get(4).toString(),
                    insertData.get(5).toString(), insertData.get(6).toString(),
                    insertData.get(7).toString(), inout);
            if (j == 0) {
                i++;
                String str = "第" + i + "条记录数据写入失败";
                JOptionPane.showMessageDialog(this, str, "错误",
                                              JOptionPane.ERROR_MESSAGE);
                return;
            }
            i++;
            if (i == vector1.size()) {
                JOptionPane.showMessageDialog(this, "数据录入成功", "提示",
                                              JOptionPane.INFORMATION_MESSAGE);
            }
        }
    }
    public void jButton4_actionPerformed(ActionEvent e) {
        if (jComboBox1.getSelectedItem().toString().equals("入库")) {
            InOut_Enter("1");
        }
        if (jComboBox1.getSelectedItem().toString().equals("出库")) {
            InOut_Enter("0");
        }
    }

    Vector vector1 = new Vector();
    JComboBox jComboBox3 = new JComboBox();
    public void jButton1_actionPerformed(ActionEvent e) {
        Vector vector = new Vector();
        double allMoney = 0;
        vector.add(jTextField2.getText());
        vector.add(jTextField3.getText());
        vector.add(jTextField4.getText());
        try {
            Double num = new Double(jTextField3.getText());
            Double money = new Double(jTextField4.getText());
            allMoney = (int) (num * money * 100) / 100.0;
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "输入的数字有误", "错误",
                                          JOptionPane.ERROR_MESSAGE);
            return;
        }
        Double dd = new Double(allMoney);
        jTextField6.setText(dd.toString());
        vector.add(dd.toString());
        vector.add(jTextField1.getText());
        vector.add(jComboBox3.getSelectedItem().toString());
        vector.add(jTextField7.getText());
        vector.add(jComboBox2.getSelectedItem().toString());
        vector1.add(vector);
        jTable1 = Mytable.maketable(vector1, colnames); //显示内容
        jScrollPane1.getViewport().add(jTable1); //把表装入容器
    }

    public void jButton2_actionPerformed(ActionEvent e) {
        int row = jTable1.getSelectedRow();
        vector1.remove(row);
        jTable1 = Mytable.maketable(vector1, colnames); //显示内容
        jScrollPane1.getViewport().add(jTable1); //把表装入容器
    }

    public void jButton3_actionPerformed(ActionEvent e) {
        vector1.removeAllElements();
        jTable1 = Mytable.maketable(vector1, colnames); //显示内容
        jScrollPane1.getViewport().add(jTable1); //把表装入容器
    }

    public void jTextField2_focusLost(FocusEvent e) {
        if (jTextField1.getText().length() != 0) {
             Vector select1 = Select_Means.Select_sort2(jTextField2.getText());
             Vector select2 = new Vector();
             if (select1.size() == 0) {
                 JOptionPane.showMessageDialog(this, "商品不存在", "错误",
                                               JOptionPane.ERROR_MESSAGE);
                 return;
             } else {
                 select2 = (Vector) select1.get(0);
                 Double pice=new Double(select2.get(4).toString());
                 double pice1=((int)(pice*100))/100.0;
                  Double pice2=new Double(pice1);
                 jTextField4.setText(pice2.toString()); //单价
             }
         }

    }


}


class Put_Out_Depot_jTextField2_focusAdapter extends FocusAdapter {
    private Put_Out_Depot adaptee;
    Put_Out_Depot_jTextField2_focusAdapter(Put_Out_Depot adaptee) {
        this.adaptee = adaptee;
    }

    public void focusLost(FocusEvent e) {
        adaptee.jTextField2_focusLost(e);
    }
}


class Put_Out_Depot_jButton3_actionAdapter implements ActionListener {
    private Put_Out_Depot adaptee;
    Put_Out_Depot_jButton3_actionAdapter(Put_Out_Depot adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton3_actionPerformed(e);
    }
}


class Put_Out_Depot_jButton2_actionAdapter implements ActionListener {
    private Put_Out_Depot adaptee;
    Put_Out_Depot_jButton2_actionAdapter(Put_Out_Depot adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton2_actionPerformed(e);
    }
}


class Put_Out_Depot_jButton1_actionAdapter implements ActionListener {
    private Put_Out_Depot adaptee;
    Put_Out_Depot_jButton1_actionAdapter(Put_Out_Depot adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton1_actionPerformed(e);
    }
}


class Put_Out_Depot_jButton4_actionAdapter implements ActionListener {
    private Put_Out_Depot adaptee;
    Put_Out_Depot_jButton4_actionAdapter(Put_Out_Depot adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.jButton4_actionPerformed(e);
    }
}

//    public void jComboBox1_actionPerformed(ActionEvent e) {
//        String str=jComboBox1.getSelectedItem().toString();
//    if(str.equals("入库")){
//
//
//    }
//    }
//
//
//}


//class Put_Out_Depot_jComboBox1_actionAdapter implements ActionListener {
//    private Put_Out_Depot adaptee;
//    Put_Out_Depot_jComboBox1_actionAdapter(Put_Out_Depot adaptee) {
//        this.adaptee = adaptee;
//    }

//    public void actionPerformed(ActionEvent e) {
//        adaptee.jComboBox1_actionPerformed(e);
//    }
//}


//    class Put_Out_Depot_jButton1_actionAdapter implements ActionListener {
//        private Put_Out_Depot adaptee;
//        Put_Out_Depot_jButton1_actionAdapter(Put_Out_Depot adaptee) {
//            this.adaptee = adaptee;
//        }
//
//        public void actionPerformed(ActionEvent e) {
//            adaptee.jButton1_actionPerformed(e);
//        }
//    }
//}

⌨️ 快捷键说明

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