提交至:branch_zyx

pull/16/head
“郑亦歆” 9 months ago
parent e8dded798d
commit 826a686744

@ -122,6 +122,7 @@ public class ChangeStatusDialog extends JDialog implements ActionListener{ //
String catalog1 = (String) cb.getSelectedItem(); // 获取下拉框选中的项 String catalog1 = (String) cb.getSelectedItem(); // 获取下拉框选中的项
if (catalog1.equals("已入库")) { // 如果选中项为"已入库" if (catalog1.equals("已入库")) { // 如果选中项为"已入库"
catalog = 1; // 将分类标识设置为1 catalog = 1; // 将分类标识设置为1
} }
else if (catalog1.equals("待入库")) { // 如果选中项为"待入库" else if (catalog1.equals("待入库")) { // 如果选中项为"待入库"
catalog = 2; // 将分类标识设置为2 catalog = 2; // 将分类标识设置为2
@ -130,6 +131,7 @@ public class ChangeStatusDialog extends JDialog implements ActionListener{ //
} }
} }
} }

@ -75,26 +75,26 @@ public class ChangeSumDialog extends JDialog implements ActionListener{ // 定
initView(); // 调用方法初始化视图 initView(); // 调用方法初始化视图
} }
private void initView() { private void initView() {
titlePanel = new JPanel(); titlePanel = new JPanel();
titleLabel = new JLabel("修改商品id为"+prodId+"的数量"); titleLabel = new JLabel("修改商品id为"+prodId+"的数量");
titlePanel.add(titleLabel); titlePanel.add(titleLabel);
sumPanel = new JPanel(); sumPanel = new JPanel();
sumLabel = new JLabel("数量"); sumLabel = new JLabel("数量");
sumTF = new JTextField(15); sumTF = new JTextField(15);
sumPanel.add(sumLabel); sumPanel.add(sumLabel);
sumPanel.add(sumTF); sumPanel.add(sumTF);
opePanel = new JPanel(); opePanel = new JPanel();
UpdateBtn = new JButton("更改"); UpdateBtn = new JButton("更改");
cancelBtn = new JButton("取消"); cancelBtn = new JButton("取消");
@ -102,13 +102,13 @@ public class ChangeSumDialog extends JDialog implements ActionListener{ // 定
cancelBtn.addActionListener(this); cancelBtn.addActionListener(this);
opePanel.add(UpdateBtn); opePanel.add(UpdateBtn);
opePanel.add(cancelBtn); opePanel.add(cancelBtn);
Container container = getContentPane(); Container container = getContentPane();
container.add(titlePanel); container.add(titlePanel);
container.add(sumPanel); container.add(sumPanel);
container.add(opePanel); container.add(opePanel);
} }
public Vector<Production> getVector(){ public Vector<Production> getVector(){
return v; return v;
} }
@ -117,13 +117,13 @@ public class ChangeSumDialog extends JDialog implements ActionListener{ // 定
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
Object source = e.getSource(); Object source = e.getSource();
if(source==UpdateBtn){ if(source==UpdateBtn){
//TODO 参数校验 //TODO 参数校验
/*/返回这个记录的信息*/ /*/返回这个记录的信息*/
int sum = Integer.parseInt(sumTF.getText());/*获得数量*/ int sum = Integer.parseInt(sumTF.getText());/*获得数量*/
System.out.println("所要修改的数量sum="+sum); System.out.println("所要修改的数量sum="+sum);
if(sumTF.getText().equals("")) { if(sumTF.getText().equals("")) {
JOptionPane.showMessageDialog(this,"请输入完整","提示",JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(this,"请输入完整","提示",JOptionPane.ERROR_MESSAGE);
return; return;
@ -133,27 +133,27 @@ public class ChangeSumDialog extends JDialog implements ActionListener{ // 定
JOptionPane.showMessageDialog(this,"请输入大于0的数量","提示",JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(this,"请输入大于0的数量","提示",JOptionPane.ERROR_MESSAGE);
return; return;
} }
BufferImpl bufferImpl = new BufferImpl(); BufferImpl bufferImpl = new BufferImpl();
productionImpl productionImpl = new productionImpl(); productionImpl productionImpl = new productionImpl();
Production production = new Production(); Production production = new Production();
production = productionImpl.findByIdProduction(prodId); production = productionImpl.findByIdProduction(prodId);
Buffer buffer = new Buffer(); Buffer buffer = new Buffer();
boolean flag = false; boolean flag = false;
if(mark=="In") {/*进货界面*/ if(mark=="In") {/*进货界面*/
for(Production p:v) { for(Production p:v) {
if(p.getId().equals(prodId)) if(p.getId().equals(prodId))
p.setSum(sum); p.setSum(sum);
} }
} }
else if(mark=="Out") {/*出货界面*/ else if(mark=="Out") {/*出货界面*/
buffer = bufferImpl.findInBufferbyId(prodId); buffer = bufferImpl.findInBufferbyId(prodId);
if(buffer!=null) {/*记录有这条数据*/ if(buffer!=null) {/*记录有这条数据*/
@ -161,25 +161,25 @@ public class ChangeSumDialog extends JDialog implements ActionListener{ // 定
JOptionPane.showMessageDialog(this,"库存数量为:"+production.getSum()+",修改数量请勿超过库存","提示",JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(this,"库存数量为:"+production.getSum()+",修改数量请勿超过库存","提示",JOptionPane.ERROR_MESSAGE);
else else
flag = bufferImpl.UpdateInBufferById(prodId, sum); flag = bufferImpl.UpdateInBufferById(prodId, sum);
} }
} }
if(flag = true) {/*如果修改成功*/ if(flag = true) {/*如果修改成功*/
JOptionPane.showMessageDialog(this,"修改成功","提示",JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(this,"修改成功","提示",JOptionPane.INFORMATION_MESSAGE);
dispose(); dispose();
}else { }else {
JOptionPane.showMessageDialog(this,"修改失败","提示",JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(this,"修改失败","提示",JOptionPane.ERROR_MESSAGE);
dispose(); dispose();
} }
} }
else if(source == cancelBtn) { else if(source == cancelBtn) {
this.dispose(); this.dispose();
} }
} }

@ -18,6 +18,7 @@ import javax.swing.JPanel; // 导入面板组件类
import javax.swing.JTable; // 导入表格组件类 import javax.swing.JTable; // 导入表格组件类
import javax.swing.JTextField; // 导入文本框组件类 import javax.swing.JTextField; // 导入文本框组件类
import com.lingnan.supermarket.*; // 导入超市项目相关的所有类 import com.lingnan.supermarket.*; // 导入超市项目相关的所有类
import com.lingnan.supermarket.dao.UserService; // 导入用户服务接口 import com.lingnan.supermarket.dao.UserService; // 导入用户服务接口
import com.lingnan.supermarket.dao.impl.BufferImpl; // 导入缓冲区服务实现类 import com.lingnan.supermarket.dao.impl.BufferImpl; // 导入缓冲区服务实现类
@ -73,6 +74,7 @@ public class InDialog extends JDialog implements ActionListener{ // 定义一个
} }
@ -137,7 +139,7 @@ public class InDialog extends JDialog implements ActionListener{ // 定义一个
catalog=select; // 更新分类信息为选中项的值 catalog=select; // 更新分类信息为选中项的值
} }
} }

@ -270,7 +270,7 @@ id2Panel.add(id2TF);*/
supplierInf.setAddress(address); supplierInf.setAddress(address);
supplierInf.setContact(contact); supplierInf.setContact(contact);
supplierInf.setId(this.supplierInf.getId()); supplierInf.setId(this.supplierInf.getId());
int result = supplierInfService.updateSupplierInf(supplierInf); int result = supplierInfService.updateSupplierInf(supplierInf);
if(result==1){ if(result==1){
JOptionPane.showMessageDialog(this, "更新成功", "提示", JOptionPane.showMessageDialog(this, "更新成功", "提示",
@ -315,6 +315,6 @@ id2Panel.add(id2TF);*/
} }
} }
} }
} }

@ -88,6 +88,8 @@ public class InRecordTM extends AbstractTableModel{ // 定义一个类,继承
return columnName[column]; // 返回columnName数组中指定索引的值 return columnName[column]; // 返回columnName数组中指定索引的值
} }
} }

@ -64,6 +64,8 @@ public class ProdCatalogTM extends AbstractTableModel{ // 定义一个类,继
return columnName[column]; // 返回指定列的列名 return columnName[column]; // 返回指定列的列名
} }
} }

@ -65,6 +65,7 @@ public class StorageRecordTM extends AbstractTableModel{ // 定义一个类,
@Override @Override
public String getColumnName(int column) { // 重写getColumnName方法返回指定列的列名 public String getColumnName(int column) { // 重写getColumnName方法返回指定列的列名
return columnName[column]; // 返回columnName数组中指定索引的值 return columnName[column]; // 返回columnName数组中指定索引的值
@ -72,4 +73,5 @@ public class StorageRecordTM extends AbstractTableModel{ // 定义一个类,
} }

@ -69,6 +69,8 @@ public class StorageTableModel extends AbstractTableModel{ // 定义一个类,
return columnName[column]; // 返回columnName数组中指定索引的值 return columnName[column]; // 返回columnName数组中指定索引的值
} }
} }

@ -100,6 +100,6 @@ public class SupplierTableModel extends AbstractTableModel{
*/ */
} }

@ -711,6 +711,8 @@ public class InView extends JPanel implements ActionListener{
JOptionPane.showConfirmDialog(null,"退出成功", "提示", JOptionPane.PLAIN_MESSAGE); JOptionPane.showConfirmDialog(null,"退出成功", "提示", JOptionPane.PLAIN_MESSAGE);
} }
}
} }
} }
}

@ -1,5 +1,6 @@
package com.lingnan.supermarket.view; // 定义包名,所有视图相关的类都在这个包下 package com.lingnan.supermarket.view; // 定义包名,所有视图相关的类都在这个包下
import java.awt.event.ActionEvent; // 导入ActionEvent类用于监听动作事件 import java.awt.event.ActionEvent; // 导入ActionEvent类用于监听动作事件
import java.awt.event.ActionListener; // 导入ActionListener接口用于实现动作事件监听 import java.awt.event.ActionListener; // 导入ActionListener接口用于实现动作事件监听
import java.awt.event.MouseEvent; // 导入MouseEvent类用于监听鼠标事件 import java.awt.event.MouseEvent; // 导入MouseEvent类用于监听鼠标事件
@ -24,6 +25,7 @@ import javax.swing.JPanel; // 导入JPanel类用于创建面板
import javax.swing.JSplitPane; // 导入JSplitPane类用于创建分隔面板 import javax.swing.JSplitPane; // 导入JSplitPane类用于创建分隔面板
import javax.swing.Timer; // 导入Timer类用于实现定时器 import javax.swing.Timer; // 导入Timer类用于实现定时器
import com.lingnan.supermarket.componet.BGPanel; // 导入自定义的BGPanel类 import com.lingnan.supermarket.componet.BGPanel; // 导入自定义的BGPanel类
import com.lingnan.supermarket.dao.impl.BufferImpl; // 导入BufferImpl类可能是数据访问层的实现 import com.lingnan.supermarket.dao.impl.BufferImpl; // 导入BufferImpl类可能是数据访问层的实现
import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; // 导入inOrderServiceImpl类可能是订单服务的实现 import com.lingnan.supermarket.dao.impl.inOrderServiceImpl; // 导入inOrderServiceImpl类可能是订单服务的实现
@ -38,8 +40,10 @@ import com.lingnan.supermarket.utils.DateUtil; // 导入DateUtil类可能是
import com.lingnan.supermarket.utils.FontUtil; // 导入FontUtil类可能是字体工具类 import com.lingnan.supermarket.utils.FontUtil; // 导入FontUtil类可能是字体工具类
import com.lingnan.supermarket.view.base.BaseView; // 导入BaseView类可能是视图基类 import com.lingnan.supermarket.view.base.BaseView; // 导入BaseView类可能是视图基类
import java.awt.*; // 导入awt包中的所有类 import java.awt.*; // 导入awt包中的所有类
// 主视图类继承自BaseView并实现多个事件监听接口 // 主视图类继承自BaseView并实现多个事件监听接口
public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{ public class MainView extends BaseView implements ActionListener, MouseListener,WindowListener{
@ -141,6 +145,8 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
} }
public static void refreshRemind() { public static void refreshRemind() {
Vector<InOrder> vInOrder; // 声明未确认订单的向量 Vector<InOrder> vInOrder; // 声明未确认订单的向量
vInOrder = inOrderImpl.findUnconfirmInOrder(); // 查找所有未确认的订单 vInOrder = inOrderImpl.findUnconfirmInOrder(); // 查找所有未确认的订单
@ -228,12 +234,14 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
leftPanel.add(homeMenuLabel); // 将首页菜单标签添加到左侧面板 leftPanel.add(homeMenuLabel); // 将首页菜单标签添加到左侧面板
/*菜单栏:人员管理*/ /*菜单栏:人员管理*/
userMenuLabel = new JLabel("人员管理", new ImageIcon("static\\icon\\user1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel用于表示人员管理菜单
userMenuLabel.setFont(FontUtil.menuFont); // 设置菜单标签的字体样式 userMenuLabel = new JLabel("人员管理",new ImageIcon("static\\icon\\user1.png"),JLabel.LEFT);
userMenuLabel.addMouseListener(this); // 为菜单标签添加鼠标事件监听器 userMenuLabel.setFont(FontUtil.menuFont);
userMenuLabel.setBounds(20, 300, 150, 32); // 设置菜单标签的位置和大小 userMenuLabel.addMouseListener(this);
userMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色 userMenuLabel.setBounds(20, 300,150,32);
leftPanel.add(userMenuLabel); // 将人员管理菜单标签添加到左侧面板 userMenuLabel.setForeground(Color.white);
leftPanel.add(userMenuLabel);/*添加用户选项到菜单栏*/
/*菜单栏:进货系统*/ /*菜单栏:进货系统*/
inMenuLabel = new JLabel("进货系统", new ImageIcon("static\\icon\\in1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel用于表示进货系统菜单 inMenuLabel = new JLabel("进货系统", new ImageIcon("static\\icon\\in1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel用于表示进货系统菜单
@ -243,13 +251,15 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
inMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色 inMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色
leftPanel.add(inMenuLabel); // 将进货系统菜单标签添加到左侧面板 leftPanel.add(inMenuLabel); // 将进货系统菜单标签添加到左侧面板
/*菜单栏:收银系统*/ /*菜单栏:收银系统*/
outMenuLabel = new JLabel("收银系统", new ImageIcon("static\\icon\\out1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel用于表示收银系统菜单 outMenuLabel = new JLabel("收银系统",new ImageIcon("static\\icon\\out1.png") ,JLabel.LEFT);
outMenuLabel.setFont(FontUtil.menuFont); // 设置菜单标签的字体样式 outMenuLabel.setFont(FontUtil.menuFont);
outMenuLabel.addMouseListener(this); // 为菜单标签添加鼠标事件监听器 outMenuLabel.addMouseListener(this);
outMenuLabel.setBounds(20, 400, 150, 32); // 设置菜单标签的位置和大小 outMenuLabel.setBounds(20, 400,150,32);
outMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色 outMenuLabel.setForeground(Color.white);
leftPanel.add(outMenuLabel); // 将收银系统菜单标签添加到左侧面板 leftPanel.add(outMenuLabel);
/*菜单栏:库存*/ /*菜单栏:库存*/
storageMenuLabel = new JLabel("商品库存", new ImageIcon("static\\icon\\storage1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel用于表示商品库存菜单 storageMenuLabel = new JLabel("商品库存", new ImageIcon("static\\icon\\storage1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel用于表示商品库存菜单
@ -268,12 +278,15 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
leftPanel.add(supplierMenuLabel); // 将供应商菜单标签添加到左侧面板 leftPanel.add(supplierMenuLabel); // 将供应商菜单标签添加到左侧面板
/*菜单栏:商品目录*/ /*菜单栏:商品目录*/
catalogMenuLabel = new JLabel("商品目录", new ImageIcon("static\\icon\\catalog1.png"), JLabel.LEFT); // 创建一个带有图标的JLabel用于表示商品目录菜单
catalogMenuLabel.setFont(FontUtil.menuFont); // 设置菜单标签的字体样式
catalogMenuLabel.addMouseListener(this); // 为菜单标签添加鼠标事件监听器
catalogMenuLabel.setBounds(20, 550, 150, 32); // 设置菜单标签的位置和大小 catalogMenuLabel = new JLabel("商品目录",new ImageIcon("static\\icon\\catalog1.png") ,JLabel.LEFT);
catalogMenuLabel.setForeground(Color.white); // 设置菜单标签的前景色为白色 catalogMenuLabel.setFont(FontUtil.menuFont);
leftPanel.add(catalogMenuLabel); // 将商品目录菜单标签添加到左侧面板 catalogMenuLabel.addMouseListener(this);
catalogMenuLabel.setBounds(20,550,150,32);
catalogMenuLabel.setForeground(Color.white);
leftPanel.add(catalogMenuLabel);
/*提醒进货确认模块*/ /*提醒进货确认模块*/
@ -284,7 +297,9 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
remindMenuLabel.setForeground(Color.white); // 设置提醒菜单标签的前景色为白色 remindMenuLabel.setForeground(Color.white); // 设置提醒菜单标签的前景色为白色
leftPanel.add(remindMenuLabel); // 将提醒菜单标签添加到左侧面板 leftPanel.add(remindMenuLabel); // 将提醒菜单标签添加到左侧面板
// 设置右侧面板的布局管理器为卡片布局 // 设置右侧面板的布局管理器为卡片布局
rightPanelLayout = new CardLayout(); rightPanelLayout = new CardLayout();
// 0.超市首页展示,创建并实例化首页视图面板 // 0.超市首页展示,创建并实例化首页视图面板
@ -522,10 +537,12 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
// 如果事件源是用户菜单标签,则改变前景色和图标 // 如果事件源是用户菜单标签,则改变前景色和图标
if(source==userMenuLabel) { if(source==userMenuLabel) {
userMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色 userMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
userMenuLabel.setIcon(new ImageIcon("static\\icon\\user2.png")); // 设置鼠标进入时的图标 userMenuLabel.setIcon(new ImageIcon("static\\icon\\user2.png")); // 设置鼠标进入时的图标
} }
// 如果事件源是入库菜单标签,则改变前景色和图标 // 如果事件源是入库菜单标签,则改变前景色和图标
else if(source==inMenuLabel) { else if(source==inMenuLabel) {
inMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色 inMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
@ -550,6 +567,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier2.png")); // 设置鼠标进入时的图标 supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier2.png")); // 设置鼠标进入时的图标
} }
// 如果事件源是目录菜单标签,则改变前景色和图标 // 如果事件源是目录菜单标签,则改变前景色和图标
else if(source==catalogMenuLabel) { else if(source==catalogMenuLabel) {
catalogMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色 catalogMenuLabel.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
@ -557,6 +575,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
} }
// 如果事件源是用户菜单标签1则改变前景色 // 如果事件源是用户菜单标签1则改变前景色
else if(source==userMenuLabel1) { else if(source==userMenuLabel1) {
userMenuLabel1.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色 userMenuLabel1.setForeground(new Color(18, 150, 219)); // 设置前景色为蓝色
// 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标进入图标 // 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标进入图标
@ -577,6 +596,7 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); // 设置鼠标离开时的默认图标 homeMenuLabel.setIcon(new ImageIcon("static\\icon\\home1.png")); // 设置鼠标离开时的默认图标
} }
// 如果事件源是用户菜单标签,则恢复前景色和图标 // 如果事件源是用户菜单标签,则恢复前景色和图标
else if(source==userMenuLabel) { else if(source==userMenuLabel) {
userMenuLabel.setForeground(Color.white); // 恢复前景色为白色 userMenuLabel.setForeground(Color.white); // 恢复前景色为白色
@ -607,13 +627,11 @@ public class MainView extends BaseView implements ActionListener, MouseListener,
supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier1.png")); // 设置鼠标离开时的默认图标 supplierMenuLabel.setIcon(new ImageIcon("static\\icon\\supplier1.png")); // 设置鼠标离开时的默认图标
} }
// 如果事件源是目录菜单标签,则恢复前景色和图标
else if(source==catalogMenuLabel) { else if(source==catalogMenuLabel) {
catalogMenuLabel.setForeground(Color.white); // 恢复前景色为白色 catalogMenuLabel.setForeground(Color.white);
catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png")); // 设置鼠标离开时的默认图标 catalogMenuLabel.setIcon(new ImageIcon("static\\icon\\catalog1.png"));
} }
// 如果事件源不是上述任何一个标签则默认处理用户菜单标签1
else { else {
userMenuLabel1.setForeground(Color.white); // 恢复前景色为白色 userMenuLabel1.setForeground(Color.white); // 恢复前景色为白色
// 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标离开图标 // 注意:这里没有设置图标,可能是因为该标签没有对应的鼠标离开图标

Loading…
Cancel
Save