JAVA医药进销存管理系统(附源码+调试)

JAVA医药进销存管理系统

功能描述

(1)登录模块:登录信息等存储在数据库中

(2)基本信息模块:分为药品信息模块、客户情况模块、供应商情况模块;

(3)业务管理模块:分为药品采购模块、药品销售模块、库存盘点模块、销售退货模块、客户回款模块;

(4)业务查询模块:分为基本信息模块、入库明细模块、销售明细模块、回款明细模块;

(5)用户管理模块:分为增加用户模块、维护用户模块;

(6)窗口管理:更适应更多使用者的前端需求。

代码链接:https://pan.baidu.com/s/1F7dEBfny5aAU_AKpLpwCiA
提取码:3pxo

功能截图

1、登录模块

2、医药进销存管理系统主界面

3、药品情况模块

4、供应商基本信息情况模块

5、入库明细模块

部分关键代码

java 复制代码
package com.lzw;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.Rectangle;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.util.Iterator;
import java.util.List;
import java.util.Scanner;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.border.BevelBorder;

import com.lzw.dao.AdapterDao;
import com.lzw.model.Obj_UserName;
import com.lzw.view.JF_main;

public class LoginDialog extends JFrame {
    private static final long serialVersionUID = 8107215375516572660L;
    private LoginPanel loginPanel = null;
    private JLabel jLabel = null;
    private JTextField userField = null;
    private JLabel jLabel1 = null;
    private JPasswordField passwordField = null;
    private JButton loginButton = null;
    private JButton exitButton = null;
    private JF_main mainFrame;
    
    /**
     * @param owner
     */
    public LoginDialog() {
        try {
            UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
            mainFrame = new JF_main();
            initialize();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    /**
     * 初始化loginPanel登录面板的方法
     * 
     * @return com.lzw.login.LoginPanel
     */
    private LoginPanel getLoginPanel() {
        if (loginPanel == null) {
            jLabel1 = new JLabel();
            jLabel1.setFont(new Font("", Font.BOLD, 12));
            jLabel1.setBounds(new Rectangle(101, 147, 55, 18));
            jLabel1.setText("密 码:");
            jLabel = new JLabel();
            jLabel.setFont(new Font("", Font.BOLD, 12));
            jLabel.setText("用户名:");
            jLabel.setBounds(new Rectangle(100, 117, 56, 18));
            loginPanel = new LoginPanel();
            loginPanel.setLayout(null);
            loginPanel.setBackground(new Color(0xD8DDC7));
            loginPanel.add(jLabel);
            loginPanel.add(getUserField());
            loginPanel.add(jLabel1);
            loginPanel.add(getPasswordField());
            loginPanel.add(getLoginButton());
            loginPanel.add(getExitButton());
        }
        return loginPanel;
    }
    
    /**
     * This method initializes userField
     * 
     * @return javax.swing.JTextField
     */
    private JTextField getUserField() {
        if (userField == null) {
            userField = new JTextField();
            userField.setBorder(new BevelBorder(BevelBorder.LOWERED));
            userField.setBounds(new Rectangle(157, 115, 127, 22));
        }
        return userField;
    }
    
    /**
     * This method initializes passwordField
     * 
     * @return javax.swing.JPasswordField
     */
    private JPasswordField getPasswordField() {
        if (passwordField == null) {
            passwordField = new JPasswordField();
            passwordField.setBorder(new BevelBorder(BevelBorder.LOWERED));
            passwordField.setBounds(new Rectangle(158, 145, 125, 22));
            passwordField.addKeyListener(new KeyAdapter() {
                @Override
                public void keyTyped(KeyEvent e) {
                    if (e.getKeyChar() == '\n')
                        loginButton.doClick();
                }
            });
        }
        return passwordField;
    }
    
    /**
     * This method initializes loginButton
     * 
     * @return javax.swing.JButton
     */
    private JButton getLoginButton() {
        if (loginButton == null) {
            loginButton = new JButton();
            loginButton.setContentAreaFilled(false);
            loginButton.setBounds(new Rectangle(155, 175, 58, 25));
            loginButton.setIcon(new ImageIcon(getClass().getResource("/images/loginButton.png")));
            loginButton.addActionListener(new ActionListener() {
                private Obj_UserName user;
                
                @Override
                public void actionPerformed(ActionEvent e) {
                    String id = getUserField().getText().trim();
                    if (id == null || id.length() <= 0) {
                        JOptionPane.showMessageDialog(null, "输入用户ID不能为空,请重新输入!!!", "系统提示", JOptionPane.ERROR_MESSAGE);
                        getUserField().requestFocus();
                        return;
                    }
                    String sqlStr = "from Obj_UserName where id = '" + id + "'";
                    List list = null;
                    list = AdapterDao.QueryObject(sqlStr);
                    if (list.size() > 0) {
                        Iterator iterator = list.iterator();
                        user = (Obj_UserName) iterator.next();
                        String pass = new String(getPasswordField().getPassword());
                        if (!user.getPassword().equals(pass)) {
                            JOptionPane.showMessageDialog(LoginDialog.this, "用户名或密码错误,无法登录", "登录失败", JOptionPane.ERROR_MESSAGE);
                            return;
                        }
                    }
                    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
                    Dimension frameSize = mainFrame.getSize();
                    if (frameSize.height > screenSize.height) {
                        frameSize.height = screenSize.height;
                    }
                    if (frameSize.width > screenSize.width) {
                        frameSize.width = screenSize.width;
                    }
                    mainFrame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
                    mainFrame.setVisible(true);
                    LoginDialog.this.setVisible(false);
                }
            });
        }
        return loginButton;
    }
    
    /**
     * This method initializes exitButton
     * 
     * @return javax.swing.JButton
     */
    private JButton getExitButton() {
        if (exitButton == null) {
            exitButton = new JButton();
            exitButton.setContentAreaFilled(false);
            exitButton.setBounds(new Rectangle(230, 175, 58, 25));
            exitButton.setIcon(new ImageIcon(getClass().getResource("/images/exitButton.png")));
            exitButton.addActionListener(new java.awt.event.ActionListener() {
                @Override
                public void actionPerformed(java.awt.event.ActionEvent e) {
                    System.exit(0);
                }
            });
        }
        return exitButton;
    }
    
    /**
     * 界面初始化方法
     * 
     * @return void
     */
    private void initialize() {
        Dimension size = getToolkit().getScreenSize();
        setLocation((size.width - 296) / 2, (size.height - 188) / 2);
        setSize(389, 256);
        this.setTitle("系统登录");
        setContentPane(getLoginPanel());
    }
    
    public static void main(String[] args) {
        try {
            new Thread() {
                private FileInputStream fis;
                private Scanner scanner;
                private LoginDialog jf_login;
                
                @Override
                public void run() {
                    try {
                        initAndRecLog(); // 初始化并记录日志
                        fis = new FileInputStream("APPJXC.log");
                        scanner = new Scanner(fis);
                        while (scanner.hasNextLine()) {
                            String str = scanner.nextLine();
                            int startInt = str.indexOf('-') + 1;
                            if (startInt == -1)
                                startInt = 0;
                            str = "启动信息:" + str.substring(startInt);
                            Thread.sleep(100);
                        }
                        scanner.close();
                        fis.close();
                        jf_login.setVisible(true);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                
                // 初始化系统,并记录日志
                private void initAndRecLog() throws FileNotFoundException {
                    FileOutputStream fop = new FileOutputStream("APPJXC.log", false);
                    PrintStream ps = new PrintStream(fop);
                    System.setOut(ps);
                    AdapterDao dao = new AdapterDao();
                    if (!dao.getdao())
                        return;
                    jf_login = new LoginDialog();
                }
            }.start();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
相关推荐
Logintern0912 小时前
windows如何设置mongodb的副本集
数据库·windows·mongodb
消失的旧时光-194313 小时前
Android回退按钮处理方法总结
android·开发语言·kotlin
Jabes.yang13 小时前
Java求职面试:从Spring Boot到Kafka的技术探讨
java·spring boot·面试·kafka·互联网大厂
千里马-horse13 小时前
Async++ 源码分析7--parallel_reduce.h
开发语言·c++·async++·parallel_reduce
量化交易曾小健(金融号)13 小时前
Python美股量化交易填坑记录——3.盈透(Interactive Brokers)证券API接口
开发语言·python
canonical_entropy13 小时前
DDD本质论:从哲学到数学,再到工程实践的完整指南之实践篇
java·后端·领域驱动设计
Madison-No714 小时前
【C++】探秘string的底层实现
开发语言·c++
_Power_Y14 小时前
Java面试常用算法api速刷
java·算法·面试
纪莫14 小时前
技术面:Spring (事务传播机制、事务失效的原因、BeanFactory和FactoryBean的关系)
java·spring·java面试⑧股
RestCloud14 小时前
在制造业数字化转型浪潮中,数据已成为核心生产要素。然而,系统割裂、数据滞后、开发运维成本高等问题,却像顽固的 “数据枷锁”,阻碍着企业发展。ETLCloud与
数据库·postgresql