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

📄 csmainmenu.java

📁 管理系统
💻 JAVA
📖 第 1 页 / 共 4 页
字号:
                                     "简介:\n   本软件主要针对珠宝店的管理\n" +
                                     "   欢迎大家下载使用,但下载地址不详!\n" +
                                     "   htpp:\\www.sex.jewelry\\.....\n"+
                                     "小组成员介绍:\n   赵睿--界面及基础信息模块\n" +
                                     "   杨凯--人员面版及代码实现模块\n" +
                                     "   严靖--客户关系及代码实现模块\n" +
                                     "   杨天伟--采购库存面版及代码实现模块\n" +
                                     "   廖理军--销售面版及代码实现模块\n"+
                                     "   联系我们:faves_007@163.com\n"+
                                     "   QQ:12153016   电话:13608090937", "SEX小组简介",
                                     JOptionPane.DEFAULT_OPTION,
                                     JOptionPane.INFORMATION_MESSAGE,
                                     n2, null, null);

    }
    //退出
    public void jMenuItem16_actionPerformed(ActionEvent e) {
        int option = JOptionPane.showConfirmDialog(this, "真的要退出本系统吗?", "退出",
                     JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, null);
         if (option == JOptionPane.NO_OPTION) {
             return;
         }else{
             this.dispose();
         }

    }
    //基础界面
    public void jButton1_actionPerformed(ActionEvent e) {
        SMainMenu sm = new SMainMenu();
        sm.baseButton(e);
        Thread thr = new Thread(sm);
        thr.start();
        this.dispose();
    }
    //库存界面
    public void jButton2_actionPerformed(ActionEvent e) {
        ASMainMenu am = new ASMainMenu();
        Thread thr = new Thread(am);
        thr.start();
        this.dispose();

    }
    //销售界面
    public void jButton3_actionPerformed(ActionEvent e) {
       ESMainMenu es = new ESMainMenu();
       Thread thr = new Thread(es);
       thr.start();
       this.dispose();

    }
    //人员界面
    public void jButton4_actionPerformed(ActionEvent e) {
        PMainMenu pm = new PMainMenu();
        Thread thr = new Thread(pm);
        thr.start();
        this.dispose();
    }
    //主界面
    public void jButton7_actionPerformed(ActionEvent e) {
        SMainMenu sm = new SMainMenu();
        Thread thr = new Thread(sm);
        thr.start();
        this.dispose();
    }

    public void jButton8_actionPerformed(ActionEvent e) {
        String str = jTextField4.getText();
        String sql = "select * from client where cname like '"+str+"%'";
        JTable jt = gt.getTable(sql);
    }


    /**
     * 提交按钮点击事件
     * @param e ActionEvent
     */
    public void jButton6_actionPerformed(ActionEvent e) throws SQLException {
        String id = cid .getText(); //获得编号
        String monye = cmonye .getText(); //获得金额
        String discut = this.jComboBox2 .getSelectedItem() .toString(); //获得折扣
        String area = carea .getText(); //获得地区
        String name = cname .getText(); //客户姓名
        String type = jComboBox1 .getSelectedItem() .toString(); //客户类型
        String sex = "";
        if(this.jRadioButton1 .isSelected()){
            sex = jRadioButton1 .getText();  //获得选中的性别
        }
        if(this.jRadioButton3 .isSelected()){
           sex = jRadioButton3 .getText();  //获得选中的性别
        }
        String age = cage .getText();  //获得年龄
        String phone = cphone .getText(); //获得电话
        String date = this.cdate .getText(); //获得日期
        String place = cplace .getText(); //获得住址
        String remark = txtremark .getText(); //获得备注
        Cid cid = new Cid();

        //判断输入的编号是否存在
        Vector ve = cid.query(id);
        if (ve.size() != 0) {
            JOptionPane.showMessageDialog(this, "此编号已存在");
            this.cid .setText("");
            this.cid.requestFocus();
            this.getNumber();
            this.cid .getText();
            return;
        }
        if(monye.equals("")){
            JOptionPane.showMessageDialog(this, "金额不能为空");
            this.cmonye.requestFocus();
            return;
        }
        //判断输入的金额是否是数字
        try {
            Float.parseFloat(this.cmonye .getText());
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this,"金额必须为数字");
            this.cmonye .setText("");
            this.cmonye .requestFocus();
            return;
        }

        //判断输入的地区名是否为空
        if(area.equals("")){
            JOptionPane.showMessageDialog(this,"地区名不能为空");
            this.carea .requestFocus();
            return;
        }
        //判断输入的地区名的长度
        if((area.length() >= 5)&&(area.length() <= 1)){
            JOptionPane.showMessageDialog(this,"地区名不能超过5个字符");
            this.carea .setText("");
            this.carea .requestFocus();
            return;
        }

        //判断输入的地区是否为数字
        char [] ch = area.toCharArray();
        for (int i = 0; i < ch.length; i++) {
            if (Character.isDigit(ch[i])) {
                JOptionPane.showMessageDialog(this,"地区名不能为数字");
                this.carea .setText("");
                this.carea .requestFocus();
                 return ;
            }
        }
        //判断输入的姓名是否为空
        if(name.equals("")){
            JOptionPane.showMessageDialog(this, "姓名不能为空");
            this.cname .requestFocus();
            return;
        }
        //判断输入的姓名长度是否正确
        if((name.length() <=1) ||(name.length() > 4)){
            JOptionPane.showMessageDialog(this, "姓名填写不对");
            this.cname .setText("");
            this.cname .requestFocus();
            return;
        }
        //判断输入的姓名是否是数字
        char [] cname = name.toCharArray();
        for (int i = 0; i < cname.length; i++) {
            if (Character.isDigit(cname[i])) {
                JOptionPane.showMessageDialog(this,"姓名不能为数字");
                this.cname .setText("");
                this.cname .requestFocus();
                 return ;
            }
        }
        if(age.equals("")){
            JOptionPane.showMessageDialog(this, "年龄不能为空");
            this.cage .requestFocus();
            return;
        }
        try {
            Integer.parseInt(this.cage .getText());
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "年龄必须为数字");
            this.cage .setText("");
            this.cage .requestFocus();
            return;
        }
        int num = 0;
        num = Integer.parseInt(age.substring(0,2));
        if((num <= 16)||(num > 100)){
            JOptionPane.showMessageDialog(this, "年龄必须为16-100之间");
            this.cage .setText("");
            this.cage .requestFocus();
            return;
        }
        //判断输入的电话号码是否为空
        if(phone.equals("")){
            JOptionPane.showMessageDialog(this, "电话号码不能为空");
            this.cphone .requestFocus();
            return;
        }
        //判断输入电话号码是否为纯数字
        try {
            Long.parseLong(this.cphone .getText());
        } catch (Exception ex) {
            JOptionPane.showMessageDialog(this, "输入的电话号码必须为纯数字");
            this.cphone .setText("");
            this.cphone .requestFocus();
            return;
        }

        if(phone.length() != 11){
            JOptionPane.showMessageDialog(this, "输入的电话号码必须为11位");
            this.cphone.setText("");
            this.cphone.requestFocus();
            return;
        }
            //判断输入的移动电话是否以13或者15开头
            //Long num1;
            Long num2 ;
           // num1 = Long.parseLong(phone.substring(0,2));
            num2 = Long.parseLong(phone.substring(0,2));
            if((num2 != 13)&&(num2 != 15)){
                JOptionPane.showMessageDialog(this, "电话号码须以13或15开头\n如 13212344321");
                this.cphone .setText("");
                this.cphone .requestFocus();
                return;
            }

        //判断输入的住址是否为空
        if(place.equals("")){
            JOptionPane.showMessageDialog(this, "输入的住址不能为空");
            this.cplace .requestFocus();
            return;
        }
        //判断输入的住址长度是否在 2 -  8个字符之间
        if((place.length() <=1)||(place.length() >=24)){
            JOptionPane.showMessageDialog(this, "输入的住址须在 2 - 8 个字符之间");
            this.cplace .setText("");
            this.cplace .requestFocus();
            return;
        }
        //判断输入的住址是否是数字
        char [] places = place.toCharArray();
        for (int i = 0; i < places.length; i++) {
           if (Character.isDigit(places[i])) {
               JOptionPane.showMessageDialog(this,"住址不能为数字");
               this.cplace.setText("");
               this.cplace.requestFocus();
               return;
           }
       }
       //判断输入的备注是否为空
       if (remark.equals("")) {
           JOptionPane.showMessageDialog(this, "备注不能为空");
           this.txtremark .requestFocus();
           return;
       }
       //判断输入的备注的长度是否在 2 - 20 个字符之间
       if ((remark.length() <= 1) || (remark.length() >= 20)) {
           JOptionPane.showMessageDialog(this, "输入的备注须在 2 - 20 个字符之间");
           this.txtremark .setText("");
           this.txtremark .requestFocus();
           return;
       }
       //判断输入的备注是否为数字
       char [] remarks = remark.toCharArray();
       for (int i = 0; i < remarks.length; i++) {
           if (Character.isDigit(remarks[i])) {
               JOptionPane.showMessageDialog(this, "住址不能为数字");
               this.txtremark .setText("");
               this.txtremark .requestFocus();
               return;
           }
       }
       ArrayList arraylist = cid.add(id,monye,discut,area,name,type,sex,age,phone,date,place,remark);
       if(arraylist == null){

       }else{
           JOptionPane.showMessageDialog(this,"增加成功");
           //刷新表格
           this.jTable1 = gt.getTable("select * from client order by cid ");
           txtlist.getViewport().add(jTable1);
           jTable1.addMouseListener(new CSMainMenu_jTable1_mouseAdapter(this));
            jTextField5.setText("查询到 "+ this.jTable1 .getRowCount()+" 条有效数据");
       }
    }

    //取消按钮点击事件
    public void jButton9_actionPerformed(ActionEvent e) {
        this.cid.setText("");
        this.cmonye.setText("");
        this.carea.setText("");
        this.cname.setText("");
        this.jRadioButton1.setText("");
        this.jRadioButton2.setText("");
        this.cage.setText("");
        this.cphone.setText("");
        this.cdate.setText("");
        this.cplace.setText("");
        this.txtremark.setText("");

        this.getNumber();
        this.cid .getText();
        jRadioButton1.setSelected(true);
        this.jComboBox2.setSelectedIndex(0);
        this.jComboBox1 .setSelectedIndex(0);
        this.getTime();
        this.cdate .getText();
    }
    //销售比例图
    public void jMenuItem22_actionPerformed(ActionEvent e) {
        SellMap sm = new SellMap();
        sm.setTitle("销售分析图");
        sm.setSize(600,400);
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        Dimension frameSize = sm.getSize();
        if (frameSize.height > screenSize.height) {
            frameSize.height = screenSize.height;
        }
        if (frameSize.width > screenSize.width) {
            frameSize.width = screenSize.width;
        }
        sm.setLocation((screenSize.width - frameSize.width) / 2,
                         (screenSize.height - frameSize.height) / 2);
        sm.setVisible(true);

    }
    //基础信息
    public void jMenuItem1_actionPerformed(ActionEvent e) {
        SMainMenu sm = new SMainMenu(); //
        sm.baseButton(e); //
        Thread thr = new Thread(sm);
        thr.start();
        this.dispose();
    }
    //库存信息
    public void jMenuItem2_actionPerformed(ActionEvent e) {
        new ASMainMenu();
        this.dispose();
    }
    //人员信息
    public void jMenuItem3_actionPerformed(ActionEvent e) {
        new PMainMenu();
        this.dispose();
    }
    //客户信息
    public void jMenuItem17_actionPerformed(ActionEvent e) {
        new CSMainMenu();
        this.dispose();
    }
    //人员信息1
    public void jMenuItem8_actionPerformed(ActionEvent e) {
        new PMainMenu();
        this.dispose();
    }
    //人员信息2
    public void jMenuItem6_actionPerformed(ActionEvent e) {
        new PMainMenu();
        this.dispose();
    }
    //销售信息
    public void jMenuItem11_actionPerformed(ActionEvent e) {
        new ESMainMenu();
        this.dispose();
    }
    //客户信息
    public void jMenuItem13_actionPerformed(ActionEvent e) {
        new CSMainMenu();
        this.dispose();

⌨️ 快捷键说明

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