📄 magazineinfosystempanel.java
字号:
} catch (Exception ex) {
// JOptionPane.showMessageDialog(null, "你没有输入读者信息");
}
if(!bianhao.equals("")){
if ((int)bianhao.charAt(0)>='A' && (int)bianhao.charAt(0) <= 'Z' ) {
//查询此编号的图书
if(bianhao.trim().length()!=20)
JOptionPane.showMessageDialog(null,"输入的编号有误!!\n请核对后再输入");
else
{
a.setText(bianhao);
//JOptionPane.showMessageDialog(null,bianhao.trim().subSequence(0,2));
//更新表
String sqlq="select * from booksInfo where bookTypeID like'"+bianhao.trim().subSequence(0,1)+"'+'%'";
tableDisp(sqlq);
//更新界面文本框
}
}
}
}
public void jtxBookNum1_mouseClicked(MouseEvent e) {
String name = jtxBookName1.getText().trim();
String fenlei =jtxBookType1.getText().trim();
String chubanshe = jtxBookConcern1.getText().trim();
String zuozhe = jtxBookAuthor.getText().trim();
String dingjia = jtxBookPurchaseMoney.getText().trim();
String yuzhong = jtxBookLanguage.getText().trim();
String shujiaweizhi = jtxBookStation.getText().trim();
String shuliang = jtxBookBorrowMoneyNum1.getText().trim();
int sl=0;
float dj=0;
if (name.equals(""))
JOptionPane.showMessageDialog(null, "期刊名称不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (fenlei.equals("请点击左边的类型选择"))
JOptionPane.showMessageDialog(null, "期刊分类没有选择,请选择左边的图书类型`", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (chubanshe.equals(""))
JOptionPane.showMessageDialog(null, "期刊出版社不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (zuozhe.equals(""))
JOptionPane.showMessageDialog(null, "期刊著者不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (shuliang.equals(""))
JOptionPane.showMessageDialog(null, "期刊的数量不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (shujiaweizhi.equals(""))
JOptionPane.showMessageDialog(null, "期刊存放的位置不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (yuzhong.equals(""))
JOptionPane.showMessageDialog(null, "期刊的语言种类不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (dingjia.equals(""))
JOptionPane.showMessageDialog(null, "期刊定价不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else{
// JOptionPane.showMessageDialog(null, "OK");
booksNumber(jtxBookNum1 );
btnAddInfo.setEnabled(true);
}
}
//生成书的编号
public void booksNumber(JTextField jtx)
{
String typename =jtxBookType1.getText().trim();
String sql = "select top 1 magazineNumber,number from magazineInfo order by id desc";
String sql2 = "select typeID from magazineType2 where magazinTypeName='"+typename+"'";
String bianhao="";
String tynum="";
String time="";
long num=0;
ResultSet re=null;
//获得总编号
re=db.search(sql);
try {
if( re.next())
{
bianhao=re.getString(1).trim();
bianhao=bianhao.substring(bianhao.length()-8);
num=re.getInt(2);
}
} catch (SQLException ex) {
System.out.println(ex.toString());
ex.printStackTrace();
}
db.myClose(1);
if(!bianhao.equals(""))
num=num+Integer.parseInt(bianhao);
bianhao=""+num;
while(bianhao.length()<8)
bianhao="0"+bianhao;
//获得类型
re=db.search(sql2);
try {
if( re.next())
{
tynum=re.getString(1).trim();
bh=tynum;
}
} catch (SQLException ex) {
System.out.println(ex.toString());
ex.printStackTrace();
}
db.myClose(1);
while(tynum.length()<4)
tynum=tynum+"0";
time=SystemFrame1.dateTime;
jtx.setText(tynum+time+bianhao);
//JOptionPane.showMessageDialog(null,bh);
}
public void btnAddInfo_actionPerformed(ActionEvent e) {
beizhu=JOptionPane.showInputDialog(null,"请输入备注信息,\n例如","内容提要...");
}
public void btnQueRen_actionPerformed(ActionEvent e) {
String name = jtxBookName1.getText().trim();
String booksNum = "";
String fenlei =jtxBookType1.getText().trim();
String chubanshe = jtxBookConcern1.getText().trim();
String zuozhe = jtxBookAuthor.getText().trim();
String dingjia = jtxBookPurchaseMoney.getText().trim();
String yuzhong = jtxBookLanguage.getText().trim();
String shujiaweizhi = jtxBookStation.getText().trim();
String shuliang = jtxBookBorrowMoneyNum1.getText().trim();
int sl=0;
float dj=0;
if (name.equals(""))
JOptionPane.showMessageDialog(null, "期刊名称不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (fenlei.equals("请点击左边的类型选择"))
JOptionPane.showMessageDialog(null, "期刊分类没有选择,请选择左边的图书类型`", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (chubanshe.equals(""))
JOptionPane.showMessageDialog(null, "期刊出版社不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (zuozhe.equals(""))
JOptionPane.showMessageDialog(null, "期刊著者不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (shuliang.equals(""))
JOptionPane.showMessageDialog(null, "期刊的数量不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (shujiaweizhi.equals(""))
JOptionPane.showMessageDialog(null, "期刊存放的位置不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (yuzhong.equals(""))
JOptionPane.showMessageDialog(null, "期刊的语言种类不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else if (dingjia.equals(""))
JOptionPane.showMessageDialog(null, "期刊定价不能为空,请继续填写```", "信息填写错误",
JOptionPane.ERROR_MESSAGE);
else
{
try {
sl = Integer.parseInt(shuliang);
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "期刊的 数量 只能是数字!!!,请继续填写```",
"数量填写错误",
JOptionPane.ERROR_MESSAGE);
return;
}
try {
dj = Float.parseFloat(dingjia);
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, "期刊的 定价 只能是数字!!!,请继续填写```",
"数量填写错误",
JOptionPane.ERROR_MESSAGE);
return;
}
booksNumber(jtxBookNum1);
booksNum = jtxBookNum1.getText().trim();
String strsql = "select TYPEID from magazineType2 where magazinTypeName = '"+fenlei+"'";
String fenleiNum="";
db.search(strsql);
try {
if(db.rs.next())
fenleiNum = db.rs.getString(1).trim();
} catch (Exception ex) {
System.out.println(ex.toString());
}
db.myClose(1);
String sqlbook = "insert into magazineInfo (magazinename,magazineNumber,typenumbers, magazineCode,magazineConcern,number,purchaseMoney,magazineLairage,lairagehandLers,remark,magazineStation,magazineLungage,isLoanable) values(?,?,?,?,?,?,?,default,?,?,?,?,default)";
PreparedStatement pe=null;
ResultSet rs=null;
try {
pe = db.conn.prepareStatement(sqlbook);
pe.setString(1,name);
pe.setString(2,booksNum);
pe.setString(3,fenleiNum);
pe.setString(4,zuozhe);
pe.setString(5,chubanshe);
pe.setInt(6,sl);
pe.setFloat(7,dj);
pe.setString(8,SystemFrame1.login);
pe.setString(9,beizhu);
pe.setString(10,shujiaweizhi);
pe.setString(11,yuzhong);
if(db.add(pe)){
db.myClose(1);
JOptionPane.showMessageDialog(null, "增加成功");
// loginTree();
String sql1="select * from magazineInfo where typenumbers ='"+fenleiNum+"'";
tableDisp(sql1);
btnAddInfo.setEnabled(false);
qingchu();
}
else
JOptionPane.showMessageDialog(null, "添加失败");
} catch (SQLException ex1) {
}
}
}
public void qingchu()
{
jtxBookName1.setText("");
jtxBookType1.setText("请点击左边的类型选择");
jtxBookNum1.setText("填写完信息点击获取编号");
jtxBookConcern1.setText("");
jtxBookAuthor.setText("");
jtxBookPurchaseMoney.setText("");
jtxBookLanguage.setText("");
jtxBookStation.setText("");
jtxBookBorrowMoneyNum1.setText("");
btnAddInfo.setEnabled(false);
}
public void btnReset_actionPerformed(ActionEvent e) {
qingchu();
}
public void jBttszxgl_actionPerformed(ActionEvent e) {
// if(jBttszxgl.getText().trim().equals("期刊注销管理")){
magaizeLogOutPanel1.setVisible(true);
jSpSystemPanel.setVisible(false);
/*
jBttszxgl.setText("期刊编目入库");
jBttsbmrk.setText("期刊注销管理");
}
else
{
magaizeLogOutPanel1.setVisible(false);
jSpSystemPanel.setVisible(true);
jBttszxgl.setText("期刊注销管理");
jBttsbmrk.setText("期刊编目入库");
}
*/
}
public void jBttsbmrk_actionPerformed(ActionEvent e) {
magaizeLogOutPanel1.setVisible(false);
jSpSystemPanel.setVisible(true);
}
public void jTeaRightTop_mouseClicked(MouseEvent e) {
if(e.getButton()==e.BUTTON1)
{
String name="";
String type="";
String num="";
String chubanshe="";
String zuozhe="";
String dingjia="";
String yuyan="";
String weizhi="";
String shuliang="";
//获取
name=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),0).toString();
// type=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),0).toString();
num=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),1).toString();
chubanshe=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),4).toString();
zuozhe=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),3).toString();
dingjia=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),6).toString();
yuyan=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),7).toString();
weizhi=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),8).toString();
shuliang=jTeaRightTop.getValueAt(jTeaRightTop.getSelectedRow(),5).toString();
jtxBookName2.setText(name);
jtxBookNum2.setText(num);
jtxBookConcern2.setText(chubanshe);
jtxBookAuthor2.setText(zuozhe);
jtxBookPurchaseMoney2.setText(dingjia);
jtxBookBorrowMoneyNum2.setText(shuliang);
jtxBookStation2.setText(weizhi);
jtxBookLanguage2.setText(yuyan);
jtxBookType2.setText(fenlei);
}
}
public void btnReset2_actionPerformed(ActionEvent e) {
jtxBookName2.setText("请点击输入名称");
jtxBookType2.setText("");
jtxBookNum2.setText("请点击输入编号");
jtxBookConcern2.setText("");
jtxBookAuthor2.setText("");
jtxBookPurchaseMoney2.setText("");
jtxBookLanguage2.setText("");
jtxBookStation2.setText("");
jtxBookBorrowMoneyNum2.setText("");
}
public void jtxBookNum1_actionPerformed(ActionEvent e) {
}
public void jtxBookNum2_actionPerformed(ActionEvent e) {
}
public void jtxBookName2_actionPerformed(ActionEvent e) {
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -