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

📄 asmainmenu.java

📁 管理系统
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            jComboBox4.setEnabled(true);
        }
        if(jRadioButton3.isSelected()){
            txtName.setText("");
            txtmath.setText("");
            txtAdd.setText("");
            txt1.setText("");
            txtnum.setText("");
            txtPrice.setText("");
            txtPrice2.setText("");
            txtID.setEditable(false);
            txtName.setEnabled(true);
            txtmath.setEnabled(true);
            txtnum.setEnabled(false);
            txtAdd.setEnabled(true);
            txt1.setEnabled(true);
            txtPrice.setEnabled(true);
            txtPrice2.setEnabled(true);
            txtTime.setEnabled(false);
            jComboBox1.setEnabled(true);
            jComboBox2.setEnabled(true);
            jComboBox3.setEnabled(true);
            jComboBox4.setEnabled(true);


        }
        if(jRadioButton1.isSelected()){
            txtName.setText("");
            txtmath.setText("");
            txtAdd.setText("");
            txtnum.setText("");
            txt1.setText("");
            txtPrice.setText("");
            txtPrice2.setText("");
            txtID.setEditable(true);
            txtName.setEnabled(false);
            txtmath.setEnabled(false);
            txtAdd.setEnabled(false);
            txt1.setEnabled(false);
            txtnum.setEnabled(false);
            txtPrice.setEnabled(false);
            txtPrice2.setEnabled(false);
            txtTime.setEnabled(false);
            jComboBox1.setEnabled(false);
            jComboBox2.setEnabled(false);
            jComboBox3.setEnabled(false);
            jComboBox4.setEnabled(false);
        }
    }
//控制按纽对表内的数据进行增加
    public void jRadioButton2_actionPerformed(ActionEvent e) {
        getTime();
        setButton();
    }

    //控制按纽对表内的数据进行更新
    public void jRadioButton3_actionPerformed(ActionEvent e) {
        getTime();
        setButton();

    }

//控制按纽对表内的数据进行删除

    public void jRadioButton1_actionPerformed(ActionEvent e) {
        getTime();
        setButton();
    }

    public void jButton10_actionPerformed(ActionEvent e) throws SQLException {
        if (this.jRadioButton2.isSelected()) {
            String id = txtID.getText();                  //珠宝编号
            String name = txtName.getText();             //珠宝名称
            String math =txtmath.getText();               //总数量
            String num = txtnum.getText();                //售出数量
            String add = txtAdd.getText();                //珠宝产地
            String rest = txt1.getText();                 //珠宝纯度
           // int price = Integer.parseInt(txtPrice.getText()) ;          //珠宝远价
            String price = txtPrice.getText();
            String price2 = txtPrice2.getText();          //珠宝售价
            String txtbox4 = jComboBox4.getSelectedItem().toString();                          //珠宝重量单位
            String time = txtTime.getText();              //珠宝入库时间
            String txtBox1 = jComboBox1.getSelectedItem().toString();  //珠宝大类
            String txtBox2 = jComboBox2.getSelectedItem().toString();  //珠宝小类
            String txtBox3 = jComboBox3.getSelectedItem().toString();  //首饰

            Aid aid = new Aid();
            Aname aname = new Aname();
//判断编号语句
            if (id.length() == 0) {
                JOptionPane.showMessageDialog(this, "编号不能为空,请填写!");
                return;
            } else {
                if (aid.aid(id)) {
                    JOptionPane.showMessageDialog(this, "编号已存在,请重新输入");
                    return;
                }
            }
//判断名称语句
            if (name.length() == 0) {
                JOptionPane.showMessageDialog(this, "珠宝名称不能为空,请填写!");
                return;
            } else {
                if (name.length() <= 1) {
                    JOptionPane.showMessageDialog(this, "珠宝名称输入错误");
                    return;
                }
//判断产地语句
            }
            if (add.length() == 0) {
                JOptionPane.showMessageDialog(this, "珠宝产地不能为空,请填写!");
                return;
            }
            //判断重量语句
            if (rest.length() == 0) {
                JOptionPane.showMessageDialog(this, "物品单位不能为空,请填写!");
                return;
            }
            //判断价格语句
            if (price.length() == 0) {
                JOptionPane.showMessageDialog(this, "成本价格不能为空,请填写!");
                return;
            }else{

                if (!this.objBool(price)) {
                   JOptionPane.showMessageDialog(this, "对不起,成本价格只能输入阿拉伯数字");
                   return;
               }


            }
            if (price2.length() == 0) {
                JOptionPane.showMessageDialog(this, "销售价格不能为空,请填写!");
                return;
            } else {
                if (!this.objBool(price2)) {
                    JOptionPane.showMessageDialog(this, "对不起,销售价格只能输入阿拉伯数字");
                    return;
                }
            }
            //判断单位语句

//导数据库

            AssetInfo ass = new AssetInfo();
            if (ass.info(id, name,math,num, txtBox2, txtBox1, txtBox3, txtbox4, rest, price,price2,
                         time, add)) {

            }
//在表格打印最新表格
            this.jbInit1();
            txtName.setText("");
            txtID.setText("");
            txtmath.setText("");
            txtAdd.setText("");
            txt1.setText("");
            txtPrice.setText("");
            txtPrice2.setText("");
            txtTime.setText("");
            JOptionPane.showMessageDialog(this, "编号" + id + "成功添加");
            getTime();
        }
//更改数据库的数据
    if(this.jRadioButton3.isSelected()){
        String id = null;
        String name = null;
        String math = null;
        String num = null;
        String box2 = null;
        String box1 = null;
        String box3 = null;
        String box4 = null;
        String txt2 = null;
        String time = null;
        String price = null;
        String price2 = null;
        String add = null;


        id = this.txtID.getText();
        name = this.txtName.getText();
        math = this.txtmath.getText();
        num = this.txtnum.getText();
        add = this.txtAdd.getText();
        txt2 = this.txt1.getText();
        price = this.txtPrice.getText();
        price2 = this.txtPrice2.getText();
        box4 = this.jComboBox4.getSelectedItem().toString();
        time = this.txtTime.getText();
        box1 = this.jComboBox1.getSelectedItem().toString();
        box2 = this.jComboBox2.getSelectedItem().toString();
        box3 = this.jComboBox3.getSelectedItem().toString();

        Aid aid = new Aid();
         Aname aname = new Aname();
          if (name.length() == 0) {
              JOptionPane.showMessageDialog(this, "珠宝名称不能为空,请填写!");
              return;
          } else {
              if (name.length() <= 1) {
                  JOptionPane.showMessageDialog(this, "珠宝名称输入错误");
                  return;
              }

          }
          if (add.length() == 0) {
              JOptionPane.showMessageDialog(this, "珠宝产地不能为空,请填写!");
              return;
          }
          if (txt2.length() == 0) {
              JOptionPane.showMessageDialog(this, "物品单位不能为空,请填写!");
              return;
          }
          if (price.length() == 0) {
              JOptionPane.showMessageDialog(this, "成本价格不能为空,请填写!");
              return;
          } else {
              if (!this.objBool(price)) {
                  JOptionPane.showMessageDialog(this, "对不起,只能输入阿拉伯数字");
                  return;
              }
          }

          if (price2.length() == 0) {
              JOptionPane.showMessageDialog(this, "销售价格不能为空,请填写!");
              return;
          } else {
              if (!this.objBool(price2)) {
                  JOptionPane.showMessageDialog(this, "对不起,只能输入阿拉伯数字");
                  return;
              }
          }


          AssetBean ass = new AssetBean();
          AssetAction act = new AssetAction();

        ass.setAid(id);
          ass.setAname(name);ass.setAcount(math);ass.setAnumber(num);ass.setAname(box2);ass.setAbig(box1);ass.setAstyle(box3);ass.setAunit(box4);
          ass.setAheft(txt2);ass.setAdate(time);ass.setAcost(price);ass.setAprice(price2);ass.setAaddress(add);
          if(act.changeSet(ass)){
              JOptionPane.showMessageDialog(this, "修改操作成功!");
          }else{
              JOptionPane.showMessageDialog(this, "修改操作失败!");
          }
          this.jbInit1();
    }

//删除数据库中的数据
    if(jRadioButton1.isSelected()){
        String id = txtID.getText();
        Aid1 aid = new Aid1();
        if (id.length() == 0) {
            JOptionPane.showMessageDialog(this, "编号不能为空,请填写!");
            return;
        }  else{
            if (!aid.aid(id)) {
                JOptionPane.showMessageDialog(this, "编号不存在,请重新输入");
                return;
            }
            AssetInfo asse = new AssetInfo();
            if (asse.info1(id)) {

            }
       }
        this.jbInit1();
         JOptionPane.showMessageDialog(this, "编号"+id+"被成功删除");
         //删除后在填写框资料
         txtName.setText("");
         txtID.setText("");
         txtmath.setText("");
         txtAdd.setText("");
         txt1.setText("");
         txtPrice.setText("");
         txtPrice2.setText("");
            txtTime.setText("");

    }
}
//产生随即数字1---1000
public void getNumber() {
    boolean sidd = true;
    do {
        String str = "ANI00" + Math.round(Math.random() * 1000 + 1);
        if (SDBManager.getOne("select aid from asset where aid = '" + str +
                              "'").isEmpty()) {
            this.txtID.setText(str);
            sidd = false;
        }
    } while (sidd);
}


//////////////////////////////
    public void jTable1_mouseClicked(MouseEvent e) {
        jTable1.setSelectionBackground(Color.GREEN);
        int row = jTable1.getSelectedRow();
        int col = jTable1.getSelectedColumn();
        if(row >= 0){
            txtID.setText(this.jTable1.getValueAt(row,0).toString());
            txtName.setText(this.jTable1.getValueAt(row,1).toString());
            txtmath.setText(this.jTable1.getValueAt(row,2).toString());
            txtnum.setText(this.jTable1.getValueAt(row,3).toString());
            jComboBox2.setSelectedItem(this.jTable1.getValueAt(row,4).toString());
            jComboBox1.setSelectedItem(this.jTable1.getValueAt(row,5).toString());
            jComboBox3.setSelectedItem(this.jTable1.getValueAt(row,6).toString());
            jComboBox4.setSelectedItem(this.jTable1.getValueAt(row,7).toString());
            txt1.setText(this.jTable1.getValueAt(row,8).toString());
            txtPrice2.setText(this.jTable1.getValueAt(row,9).toString());
            txtPrice.setText(this.jTable1.getValueAt(row,10).toString());
            txtTime.setText(this.jTable1.getValueAt(row,11).toString());
            txtAdd.setText(this.jTable1.getValueAt(row,12).toString());
        }
    }


    class ASMainMenu_jRadioButton1_actionAdapter implements ActionListener {
        private ASMainMenu adaptee;
        ASMainMenu_jRadioButton1_actionAdapter(ASMainMenu adaptee) {
            this.adaptee = adaptee;
        }

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

    }


    class ASMainMenu_jRadioButton2_actionAdapter implements ActionListener {
        private ASMainMenu adaptee;
        ASMainMenu_jRadioButton2_actionAdapter(ASMainMenu adaptee) {
            this.adaptee = adaptee;
        }

⌨️ 快捷键说明

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