Программное обеспечение учёта медицинских препаратов на складе

Разработка распределённой системы учёта медицинских препаратов на складе. Требования к программному обеспечению, анализ концептуальной модели. Архитектурное проектирование программы в среде NetBeans 6.7.1 и СУБД JavaDB. Проверка ее работоспособности.

Рубрика Программирование, компьютеры и кибернетика
Вид курсовая работа
Язык русский
Дата добавления 23.08.2014
Размер файла 1,5 M

Отправить свою хорошую работу в базу знаний просто. Используйте форму, расположенную ниже

Студенты, аспиранты, молодые ученые, использующие базу знаний в своей учебе и работе, будут вам очень благодарны.

addShipmentBox.setLocationRelativeTo(mainFrame);

}

addShipmentBox.Initialize(false);

StockApp.getApplication().show(addShipmentBox);

RefillShipmentTable();

RefillProductsTable();

}

private void jTabbedPane1FocusGained(java.awt.event.FocusEvent evt) {

}

// Refresh with filter button

private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {

Employee employeeFilter = (Employee)dropdownEmployeeFilter.getSelectedItem();

Product productFilter = (Product)dropdownProductFilter.getSelectedItem();

RefillShipmentTable(

StockDatabase.getInstance().getShipments().GetShipmentList(

employeeFilter.getId(), productFilter.getId()));

}

private void btnAddProductMouseClicked(java.awt.event.MouseEvent evt) {

// TODO add your handling code here:

if (addProductBox == null) {

JFrame mainFrame = StockApp.getApplication().getMainFrame();

addProductBox = new AddProductDialog(mainFrame);

addProductBox.setLocationRelativeTo(mainFrame);

}

StockApp.getApplication().show(addProductBox);

RefillProductsTable();

dropdownProductFilter.setModel(getProductsModel());

}

// Variables declaration - do not modify

private javax.swing.JButton btnAddProduct;

private javax.swing.JButton btnIncoming;

private javax.swing.JButton btnOutcoming;

private javax.swing.JButton btnRefresh;

private javax.swing.JComboBox dropdownEmployeeFilter;

private javax.swing.JComboBox dropdownProductFilter;

private javax.swing.JButton jButton2;

private javax.swing.JLabel jLabel1;

private javax.swing.JMenuItem jMenuItem1;

private javax.swing.JPanel jPanel1;

private javax.swing.JPanel jPanel2;

private javax.swing.JPopupMenu jPopupMenu;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JTabbedPane jTabbedPane1;

private javax.swing.JPanel mainPanel;

private javax.swing.JTable tableProducts;

private javax.swing.JTable tableShipments;

private org.jdesktop.beansbinding.BindingGroup bindingGroup;

// End of variables declaration

private final Timer messageTimer;

private final Timer busyIconTimer;

private final Icon idleIcon;

private final Icon[] busyIcons = new Icon[15];

private int busyIconIndex = 0;

private JDialog aboutBox;

private AddShipmentDialog addShipmentBox;

private AddProductDialog addProductBox;

}

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

/*

* LoginForm.java

*

* Created on 19.03.2011, 18:23:01

*/

package stock;

import DAL.StockDatabase;

import Entities.Product;

/**

*

* @author Humanity

*/

public class AddProductDialog extends javax.swing.JDialog {

/** Creates new form LoginForm */

public AddProductDialog(java.awt.Frame parent) {

super(parent);

initComponents();

ClearForm();

this.setModal(true);

}

public AddProductDialog() {

initComponents();

ClearForm();

}

private void ClearForm() {

txtName.setText("");

txtManufacturer.setText("");

}

/** This method is called from within the constructor to

* initialize the form.

* WARNING: Do NOT modify this code. The content of this method is

* always regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

btnRegister = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

lblStatus = new javax.swing.JLabel();

txtName = new javax.swing.JTextField();

txtManufacturer = new javax.swing.JTextField();

jLabel5 = new javax.swing.JLabel();

setTitle("Add product");

setModal(true);

setName("Form"); // NOI18N

setResizable(false);

javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(stock.StockApp.class).getContext().getActionMap(AddProductDialog.class, this);

btnRegister.setAction(actionMap.get("RegisterClick")); // NOI18N

btnRegister.setText("Add Product");

btnRegister.setName("btnRegister"); // NOI18N

btnRegister.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

btnRegisterMouseClicked(evt);

}

});

jLabel4.setText("Product name");

jLabel4.setName("jLabel4"); // NOI18N

lblStatus.setName("lblStatus"); // NOI18N

txtName.setName("txtName"); // NOI18N

txtManufacturer.setName("txtManufacturer"); // NOI18N

jLabel5.setText("Manufacturer");

jLabel5.setName("jLabel5"); // NOI18N

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addComponent(jLabel4)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 64, Short.MAX_VALUE)

.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addComponent(jLabel5)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 65, Short.MAX_VALUE)

.addComponent(txtManufacturer, javax.swing.GroupLayout.PREFERRED_SIZE, 161, javax.swing.GroupLayout.PREFERRED_SIZE))

.addComponent(lblStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)

.addComponent(btnRegister, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE))

.addContainerGap())

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel4)

.addComponent(txtName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(txtManufacturer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel5))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(btnRegister, javax.swing.GroupLayout.PREFERRED_SIZE, 21, Short.MAX_VALUE)

.addContainerGap())

);

pack();

}// </editor-fold>

private void btnRegisterMouseClicked(java.awt.event.MouseEvent evt) {

String name = txtName.getText();

String manufacturer = txtManufacturer.getText();

if (name.length() == 0) {

lblStatus.setText("Enter a product name please");

return;

}

if (manufacturer.length() == 0) {

lblStatus.setText("Enter manufacturer's name please");

return;

}

Product product = new Product(0, name, manufacturer, 0);

if (StockDatabase.getInstance().getProducts().InsertProduct(product)) {

//success

setVisible(false);

} else {

lblStatus.setText("An error occured");

return;

}

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new AddShipmentDialog().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton btnRegister;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel lblStatus;

private javax.swing.JTextField txtManufacturer;

private javax.swing.JTextField txtName;

// End of variables declaration

}

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

/*

* LoginForm.java

*

* Created on 19.03.2011, 18:23:01

*/

package stock;

import DAL.StockDatabase;

import Entities.Employee;

import Entities.Product;

import Entities.Shipment;

import java.awt.Component;

import java.util.Date;

import java.util.Vector;

import javax.swing.ComboBoxModel;

import javax.swing.DefaultComboBoxModel;

import javax.swing.JOptionPane;

import org.jdesktop.application.Action;

/**

*

* @author Humanity

*/

public class AddShipmentDialog extends javax.swing.JDialog {

/** Creates new form LoginForm */

public AddShipmentDialog(java.awt.Frame parent) {

super(parent);

initComponents();

//getRootPane().setDefaultButton(btnLogIn);

quantityRatio = 1;

this.setModal(true);

}

public AddShipmentDialog() {

initComponents();

quantityRatio = 1;

}

// Positive for incoming goods, negative for outcoming

private int quantityRatio;

public void Initialize(boolean isIncoming){

quantityRatio = isIncoming ? 1 : -1;

setTitle(isIncoming

? "Incoming Shipment"

: "Outcoming Shipment");

}

protected ComboBoxModel getProductsModel() {

ComboBoxModel model = new DefaultComboBoxModel(

StockDatabase.getInstance().getProducts().GetAllProducts().toArray());

return model;

}

protected ComboBoxModel getEmployeeModel() {

ComboBoxModel model = new DefaultComboBoxModel(

StockDatabase.getInstance().getEmployee().GetAllEmployees().toArray());

return model;

}

/** This method is called from within the constructor to

* initialize the form.

* WARNING: Do NOT modify this code. The content of this method is

* always regenerated by the Form Editor.

*/

@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">

private void initComponents() {

btnRegister = new javax.swing.JButton();

jLabel4 = new javax.swing.JLabel();

lblStatus = new javax.swing.JLabel();

dropdownProduct = new javax.swing.JComboBox();

dateChooser = new com.toedter.calendar.JDateChooser();

spinQuantity = new javax.swing.JSpinner();

dropdownPerson = new javax.swing.JComboBox();

jLabel1 = new javax.swing.JLabel();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

setTitle("Incoming Shipment");

setModal(true);

setName("Form"); // NOI18N

setResizable(false);

javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(stock.StockApp.class).getContext().getActionMap(AddShipmentDialog.class, this);

btnRegister.setAction(actionMap.get("RegisterClick")); // NOI18N

btnRegister.setText("Add Shipment");

btnRegister.setName("btnRegister"); // NOI18N

btnRegister.addMouseListener(new java.awt.event.MouseAdapter() {

public void mouseClicked(java.awt.event.MouseEvent evt) {

btnRegisterMouseClicked(evt);

}

});

jLabel4.setText("Product");

jLabel4.setName("jLabel4"); // NOI18N

lblStatus.setName("lblStatus"); // NOI18N

dropdownProduct.setModel(getProductsModel());

dropdownProduct.setName("dropdownProduct"); // NOI18N

dateChooser.setDate(new Date());

dateChooser.setName("dateChooser"); // NOI18N

spinQuantity.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(1), Integer.valueOf(1), null, Integer.valueOf(1)));

spinQuantity.setName("spinQuantity"); // NOI18N

dropdownPerson.setModel(getEmployeeModel());

dropdownPerson.setName("dropdownPerson"); // NOI18N

jLabel1.setText("Quantity");

jLabel1.setName("jLabel1"); // NOI18N

jLabel2.setText("Date");

jLabel2.setName("jLabel2"); // NOI18N

jLabel3.setText("Responsible person");

jLabel3.setName("jLabel3"); // NOI18N

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());

getContentPane().setLayout(layout);

layout.setHorizontalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(btnRegister, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE)

.addGroup(layout.createSequentialGroup()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addComponent(jLabel4)

.addComponent(jLabel1)

.addComponent(jLabel2)

.addComponent(jLabel3))

.addGap(18, 18, 18)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)

.addComponent(dropdownProduct, 0, 180, Short.MAX_VALUE)

.addComponent(spinQuantity, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)

.addComponent(dateChooser, javax.swing.GroupLayout.DEFAULT_SIZE, 180, Short.MAX_VALUE)

.addComponent(dropdownPerson, 0, 180, Short.MAX_VALUE)))

.addComponent(lblStatus, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 291, Short.MAX_VALUE))

.addContainerGap())

);

layout.setVerticalGroup(

layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)

.addGroup(layout.createSequentialGroup()

.addContainerGap()

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(jLabel4)

.addComponent(dropdownProduct, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(spinQuantity, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel1))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)

.addComponent(dateChooser, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel2))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)

.addComponent(dropdownPerson, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

.addComponent(jLabel3))

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(lblStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)

.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)

.addComponent(btnRegister, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)

.addContainerGap())

);

pack();

}// </editor-fold>

private void btnRegisterMouseClicked(java.awt.event.MouseEvent evt) {

Product product = (Product) dropdownProduct.getSelectedItem();

int quantity = (Integer) spinQuantity.getValue();

Date date = dateChooser.getDate();

Employee person = (Employee) dropdownPerson.getSelectedItem();

if (quantity <= 0) {

lblStatus.setText("Quantity must be positive");

return;

}

if (product == null) {

lblStatus.setText("Select a product please");

return;

}

if (person == null) {

lblStatus.setText("Select a responsive person please");

return;

}

// Positive for incoming goods, negative for outcoming

quantity = quantityRatio * quantity;

Product p = StockDatabase.getInstance().getProducts().GetProductById(product.getId());

if (quantity < 0 &&

p.getQuantityinstock() < Math.abs(quantity)) {

// trying to take TOO MUCH from stock...

lblStatus.setText("There are only "+p.getQuantityinstock()+" items of this product in stock.");

return;

}

Shipment shipment = new Shipment();

shipment.setProductid(product);

shipment.setQuantity(quantity);

shipment.setDatetime(date);

shipment.setResponsiblepersonid(person);

if (StockDatabase.getInstance().getShipments().InsertShipment(shipment)) {

//success

setVisible(false);

} else {

lblStatus.setText("An error occured");

return;

}

}

/**

* @param args the command line arguments

*/

public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new AddShipmentDialog().setVisible(true);

}

});

}

// Variables declaration - do not modify

private javax.swing.JButton btnRegister;

private com.toedter.calendar.JDateChooser dateChooser;

private javax.swing.JComboBox dropdownPerson;

private javax.swing.JComboBox dropdownProduct;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel lblStatus;

private javax.swing.JSpinner spinQuantity;

// End of variables declaration

}

Размещено на Allbest.ru


Подобные документы

Работы в архивах красиво оформлены согласно требованиям ВУЗов и содержат рисунки, диаграммы, формулы и т.д.
PPT, PPTX и PDF-файлы представлены только в архивах.
Рекомендуем скачать работу.