📄 mainframe.java
字号:
return;
}
if(selectedValue.equals("所有商品明细类")){
secondTo=new SecondCatalogToPane(this);
return;
}
if(selectedValue.equals("所有具体商品")){
thirdTo=new ThirdCatalogToPane(this);
return;
}
}
//导入文件处理
if(e.getSource()==importFrom){
String[] values={"出货情况","进货情况","商品大类","商品明细类","具体商品"};
String selectedValue=(String)JOptionPane.showInputDialog(null, "请选择导入数据类别:","数据的导入",JOptionPane.INFORMATION_MESSAGE,null,values,values[0]);
if(selectedValue==null){
//JOptionPane.showMessageDialog(null, "请选择导入数据类别!","警告",JOptionPane.ERROR_MESSAGE);
return;
}
if(selectedValue.equals("进货情况")){
goodsInFromPane=new GoodsInFromPane(this);
return;
}
if(selectedValue.equals("出货情况")){
goodsOutFromPane=new GoodsOutFromPane(this);
return;
}
if(selectedValue.equals("商品大类")){
firstFrom=new FirstCatalogFromPane(this);
return;
}
if(selectedValue.equals("商品明细类")){
secondFrom=new SecondCatalogFromPane(this);
return;
}
if(selectedValue.equals("具体商品")){
thirdFrom=new ThirdCatalogFromPane(this);
return;
}
}
if(e.getSource()==add){
addPane=new addPanel();
JDialog dialog=new JDialog(this,true);
dialog.setSize(300, 250);
dialog.setLocation(100, 50);
dialog.getContentPane().add(addPane);
dialog.setVisible(true);
return;
}
if(e.getSource()==modify){
modifyPane=new ModifyPanel();
JDialog dialog=new JDialog(this,true);
dialog.setSize(300, 250);
dialog.setLocation(100, 50);
dialog.getContentPane().add(modifyPane);
dialog.setVisible(true);
return;
}
if(e.getSource()==delete){
deletePane=new DeletePane();
JDialog dialog=new JDialog(this,true);
dialog.setSize(300, 200);
dialog.setLocation(100, 50);
dialog.getContentPane().add(deletePane);
dialog.setVisible(true);
return;
}
if(e.getSource()==First_In){
firstCatalog=new FirstCatalogPane();
JDialog dialog=new JDialog(this,true);
dialog.setSize(250, 200);
dialog.setLocation(100, 50);
dialog.getContentPane().add(firstCatalog);
dialog.setVisible(true);
return;
}
if(e.getSource()==Second_In){
secondCatalog=new SecondCatalogPane();
JDialog dialog=new JDialog(this,true);
dialog.setSize(200, 300);
dialog.setLocation(100, 50);
dialog.getContentPane().add(secondCatalog);
dialog.setVisible(true);
return;
}
if(e.getSource()==Third_In){
thirdCatalog=new ThirdCatalogPane();
JDialog dialog=new JDialog(this,true);
dialog.setSize(400, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(thirdCatalog);
dialog.setVisible(true);
return;
}
if(e.getSource()==goods_In){
goodsInPane=new GoodsInPane();
JDialog dialog=new JDialog(this,true);
dialog.setSize(400, 250);
dialog.setLocation(100, 50);
dialog.getContentPane().add(goodsInPane);
dialog.setVisible(true);
return;
}
if(e.getSource()==goods_Out){
goodsOutPane=new GoodsOutPane();
JDialog dialog=new JDialog(this,true);
dialog.setSize(400, 250);
dialog.setLocation(100, 50);
dialog.getContentPane().add(goodsOutPane);
dialog.setVisible(true);
return;
}
if(e.getSource()==First_Delete){
deleteItemFromFirstCatalog=new DeleteItemFromFirstCatalog();
JDialog dialog=new JDialog(this,true);
dialog.setSize(400, 250);
dialog.setLocation(100, 50);
dialog.getContentPane().add(deleteItemFromFirstCatalog);
dialog.setVisible(true);
return;
}
if(e.getSource()==Second_Delete){
deleteItemFromSecondCatalog=new DeleteItemFromSecondCatalog();
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 250);
dialog.setLocation(100, 50);
dialog.getContentPane().add(deleteItemFromSecondCatalog);
dialog.setVisible(true);
}
if(e.getSource()==Third_Delete){
deleteItemFromThirdCatalog=new DeleteItemFromThirdCatalog();
JDialog dialog=new JDialog(this,true);
dialog.setSize(400, 250);
dialog.setLocation(100, 50);
dialog.getContentPane().add(deleteItemFromThirdCatalog);
dialog.setVisible(true);
}
if(e.getSource()==goods_In_Out_Delete){
deleteItemFromoperationRecord=new DeleteItemFromoperationRecord();
JDialog dialog=new JDialog(this,true);
dialog.setSize(500, 300);
dialog.setLocation(100, 50);
dialog.getContentPane().add(deleteItemFromoperationRecord);
dialog.setVisible(true);
}
if(e.getSource()==bestSaler){
bestSalerPane=new BestSalerPane();
JDialog dialog=new JDialog(this,true);
dialog.setSize(700, 600);
dialog.setLocation(100, 50);
dialog.getContentPane().add(bestSalerPane);
dialog.setVisible(true);
}
if(e.getSource()==salesOfToday){
totalSaleConditionOfToday=new TotalSaleConditionOfToday();
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(totalSaleConditionOfToday);
dialog.setVisible(true);
}
if(e.getSource()==salesOfThisMonth){
totalSaleConditionOfThisMonth=new TotalSaleConditionOfThisMonth();
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(totalSaleConditionOfThisMonth);
dialog.setVisible(true);
}
if(e.getSource()==salesOfThisYear){
totalSaleConditionOfThisYear=new TotalSaleConditionOfThisYear();
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(totalSaleConditionOfThisYear);
dialog.setVisible(true);
}
if(e.getSource()==stores_in){
totalStore=new TotalStore();
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(totalStore);
dialog.setVisible(true);
}
if(e.getSource()==saleOfToday){
int tip1=1;//该参数说明查的是本日的统计数据
int tip2=0;//该参数说明查的是本日的哪一类的统计数据
String[] values={"按大类查询","按明细类查询","按具体商品查询"};
String[] valuesOfFirst=null;
String[] valuesOfSecond=null;
String[] valuesOfThird=null;
String selected=null;
String selectedValue=(String)JOptionPane.showInputDialog(null, "请选择查询方式:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, values, values[0]);
if(selectedValue==null){
return;
}
if(selectedValue.equalsIgnoreCase("按大类查询")){
GetAllNamesFromFirstCatalog allNamesOfFirst=new GetAllNamesFromFirstCatalog();
ResultSet set=allNamesOfFirst.getSet();
int count=0;
tip2=1;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品大类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfFirst=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfFirst[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品大类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfFirst, valuesOfFirst[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按明细类查询")){
GetAllNamesFromSecondCatalog allNamesOfSecond=new GetAllNamesFromSecondCatalog();
ResultSet set=allNamesOfSecond.getSet();
int count=0;
tip2=2;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品明细类!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfSecond=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfSecond[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品明细类:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfSecond, valuesOfSecond[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
if(selectedValue.equals("按具体商品查询")){
GetAllNamesFromThirdCatalog allNamesOfThird=new GetAllNamesFromThirdCatalog();
ResultSet set=allNamesOfThird.getSet();
int count=0;
tip2=3;
try{
while(set.next()){
count++;
}
if(count==0){
JOptionPane.showMessageDialog(null, "目前没有任何商品!","提示",JOptionPane.INFORMATION_MESSAGE);
return;
}
valuesOfThird=new String[count];
set.beforeFirst();
count=0;
while(set.next()){
valuesOfThird[count++]=set.getString(1);
}
selected=(String)JOptionPane.showInputDialog(null, "请选择商品:", "请选择", JOptionPane.INFORMATION_MESSAGE, null, valuesOfThird, valuesOfThird[0]);
//以下代码传递selectedOfFirst的值到类获得统计结果
}catch(Exception excep){
excep.printStackTrace();
}
}
SingleSaleConditionPane singleSaleConditionPane=new SingleSaleConditionPane(tip1,tip2,selected);
JDialog dialog=new JDialog(this,true);
dialog.setSize(600, 400);
dialog.setLocation(100, 50);
dialog.getContentPane().add(singleSaleConditionPane);
dialog.setVisible(true);
}
if(e.getSource()==saleOfThisMonth){
int tip1=2;//该参数说明查的是本月的统计数据
int tip2=0;//该参数说明查的是本月的哪一类的统计数据
String[] values={"按大类查询","按明细类查询","按具体商品查询"};
String[] valuesOfFirst=null;
String[] valuesOfSecond=null;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -