📄 anzhuang.java
字号:
}else if(e.getSource()==xiugaib){
if(yewuyuant.getText().trim().length()>24){
JOptionPane.showMessageDialog(null,"业务员不能超过24字符");
}else if(kehunamet.getText().trim().length()>50){
JOptionPane.showMessageDialog(null,"客户名不能超过50字符");
}else if(lianxitelt.getText().trim().length()>24){
JOptionPane.showMessageDialog(null,"联系电话不能超过24字符");
}else if(bianhaot.getText().trim().length()>24){
JOptionPane.showMessageDialog(null,"编号不能超过24字符");
}else if(anzhuangyuant1.getText().trim().length()>50){
JOptionPane.showMessageDialog(null,"安装人员不能超过50字符");
}else if(guiget.getText().trim().length()>24){
JOptionPane.showMessageDialog(null,"规格不能超过24字符");
}else if(yibiaoxinghaot.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"仪表型号不能超过12字符");
}else if(yibiaoxinghaot.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"仪表编号不能超过12字符");
}else if(chuanganqiMaxt.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器量程不能超过12字符");
}else if(hao1.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号1不能超过12字符");
}else if(hao2.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号2不能超过12字符");
}else if(hao3.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号3不能超过12字符");
}else if(hao4.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号4不能超过12字符");
}else if(hao5.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号5不能超过12字符");
}else if(hao6.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号6不能超过12字符");
}else if(hao7.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号7不能超过12字符");
}else if(hao8.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器编号8不能超过12字符");
}else if(du1.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度1不能超过12字符");
}else if(du2.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度2不能超过12字符");
}else if(du3.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度3不能超过12字符");
}else if(du4.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度4不能超过12字符");
}else if(du5.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度5不能超过12字符");
}else if(du6.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度6不能超过12字符");
}else if(du7.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度7不能超过12字符");
}else if(du8.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"传感器灵敏度8不能超过12字符");
}else if(ji1.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础1不能超过12字符");
}else if(ji2.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础2不能超过12字符");
}else if(ji3.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础3不能超过12字符");
}else if(ji4.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础4不能超过12字符");
}else if(ji5.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础5不能超过12字符");
}else if(ji6.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础6不能超过12字符");
}else if(ji7.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础7不能超过12字符");
}else if(ji8.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"承重底板基础8不能超过12字符");
}else if(cha1.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差1不能超过12字符");
}else if(cha2.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差2不能超过12字符");
}else if(cha3.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差3不能超过12字符");
}else if(cha4.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差4不能超过12字符");
}else if(cha5.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差5不能超过12字符");
}else if(cha6.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差6不能超过12字符");
}else if(cha7.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差7不能超过12字符");
}else if(cha8.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"正负差8不能超过12字符");
}else if(tiaoshirent.getText().trim().length()>50){
JOptionPane.showMessageDialog(null,"厂内检验人不能超过50字符");
}else if(tiaoshirent.getText().trim().length()>50){
JOptionPane.showMessageDialog(null,"厂内检验人不能超过50字符");
}else if(at.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"a 不能超过12字符");
}else if(bt.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"b 不能超过12字符");
}else if(c1t.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"c1 不能超过12字符");
}else if(c2t.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"c2 不能超过12字符");
}else if(c3t.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"c3 不能超过12字符");
}else if(c4t.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"c4 不能超过12字符");
}else if(d1t.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"d1 不能超过12字符");
}else if(d2t.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"d2 不能超过12字符");
}else if(et.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"e 不能超过12字符");
}else if(ft.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"f 不能超过12字符");
}else if(gt.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"g 不能超过12字符");
}else if(jianchirent.getText().trim().length()>50){
JOptionPane.showMessageDialog(null,"检尺人不能超过50字符");
}else if(yibiaoht.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"H不能超过12字符");
}else if(yibiaoct.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"C不能超过12字符");
}else if(yibiaocht.getText().trim().length()>12){
JOptionPane.showMessageDialog(null,"CH不能超过12字符");
}else if(caozuoyuant.getText().trim().length()>24){
JOptionPane.showMessageDialog(null,"操作员不能超过24字符");
}else if(telt.getText().trim().length()>24){
JOptionPane.showMessageDialog(null,"操作员电话不能超过24字符");
}else{
String m="确定要修改本条信息么?";
int ok=JOptionPane.showConfirmDialog(this,m,"确认",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
if(ok==JOptionPane.YES_OPTION){
String timestr="";
//--------------------当前系统时间---------------------------------------
java.util.Date currentTime =new java.util.Date();
java.text.SimpleDateFormat formatter;
formatter=new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
timestr+=formatter.format(currentTime);
//-----------------------------------------------------------------------
StringBuffer sql=new StringBuffer();
sql.append("update anzhuangTab set yewuname='").append(yewuyuant.getText().trim()).append("',kehuname='").append(kehunamet.getText().trim()).append("',lianxitel='").append(lianxitelt.getText().trim()).append("',bianhao='").append(bianhaot.getText().trim()).append("',guiget='").append(guiget.getText().trim()).append("',anzhuangyuan='").append(anzhuangyuant1.getText().trim()).append("',yibiaoxinghao='").append(yibiaoxinghaot.getText().trim());
sql.append("',yibiaobianhao='").append(yibiaobianhaot.getText().trim()).append("',chuanganqiMax='").append(chuanganqiMaxt.getText().trim()).append("',hao1='").append(hao1.getText().trim()).append("',hao2='").append(hao2.getText().trim()).append("',hao3='").append(hao3.getText().trim()).append("',hao4='").append(hao4.getText().trim()).append("',hao5='").append(hao5.getText().trim()).append("',hao6='").append(hao6.getText().trim()).append("',hao7='").append(hao7.getText().trim()).append("',hao8='").append(hao8.getText().trim()).append("',du1='").append(du1.getText().trim()).append("',du2='").append(du2.getText().trim()).append("',du3='").append(du3.getText().trim()).append("',du4='").append(du4.getText().trim()).append("',du5='").append(du5.getText().trim()).append("',du6='").append(du6.getText().trim()).append("',du7='").append(du7.getText().trim()).append("',du8='").append(du8.getText().trim()).append("',ji1='").append(ji1.getText().trim()).append("',ji2='").append(ji2.getText().trim()).append("',ji3='").append(ji3.getText().trim()).append("',ji4='").append(ji4.getText().trim()).append("',ji5='").append(ji5.getText().trim()).append("',ji6='").append(ji6.getText().trim()).append("',ji7='").append(ji7.getText().trim()).append("',ji8='").append(ji8.getText().trim()).append("',cha1='").append(cha1.getText().trim()).append("',cha2='").append(cha2.getText().trim()).append("',cha3='").append(cha3.getText().trim()).append("',cha4='").append(cha4.getText().trim()).append("',cha5='").append(cha5.getText().trim()).append("',cha6='").append(cha6.getText().trim()).append("',cha7='").append(cha7.getText().trim()).append("',cha8='").append(cha8.getText().trim());
sql.append("',tiaoshiren='").append(tiaoshirent.getText().trim()).append("',tiaoshidate='").append(tiaoshidatet.getText().trim()).append("',a='").append(at.getText().trim()).append("',b='").append(bt.getText().trim()).append("',c1='").append(c1t.getText().trim()).append("',c2='").append(c2t.getText().trim()).append("',c3='").append(c3t.getText().trim()).append("',c4='").append(c4t.getText().trim()).append("',d1='").append(d1t.getText().trim()).append("',d2='").append(d2t.getText().trim()).append("',e='").append(et.getText().trim()).append("',f='").append(ft.getText().trim()).append("',g='").append(gt.getText().trim()).append("',jianchiren='").append(jianchirent.getText().trim()).append("',jianchidate='").append(jianchidatet.getText().trim()).append("',yibiaoh='").append(yibiaoht.getText().trim());
sql.append("',updateTime='").append(timestr).append("',yibiaoc='").append(yibiaoct.getText().trim()).append("',yibiaoch='").append(yibiaocht.getText().trim()).append("',caozuoyuan='").append(caozuoyuant.getText().trim()).append("',tel='").append(telt.getText().trim()).append("',anzhuangriqi='").append(anzhuangriqit.getText().trim()).append("',jieshu='").append(jieshu.getSelectedItem().trim()).append("' where kehuname='").append(kehunamet.getText().trim()).append("'");
ResultSet resSet;
Connection dbConn;
Statement stat;
try{
Class.forName(Yewu.forName);
dbConn=DriverManager.getConnection(Yewu.jdbc);
stat=dbConn.createStatement();
resSet=stat.executeQuery("select yewuname,kehuname from anzhuangTab where kehuname='"+kehunamet.getText().trim()+"'");
if(resSet.next()){
if(stat.executeUpdate(sql.toString())>0){
JOptionPane.showMessageDialog(null," 修改成功");
}
}else{
JOptionPane.showMessageDialog(null,"该信息不存在");
}
stat.close();
dbConn.close();
}catch(Exception ew){
System.out.println(ew);
JOptionPane.showMessageDialog(null,"数据库服务器是否启动");
}
}
}
}else if(e.getSource()==shanchub){
String m="确定要删除本条信息么?";
int ok=JOptionPane.showConfirmDialog(this,m,"确认",JOptionPane.YES_NO_OPTION,JOptionPane.QUESTION_MESSAGE);
if(ok==JOptionPane.YES_OPTION){
ResultSet resSet;
Connection dbConn;
Statement stat;
try{
Class.forName(Yewu.forName);
dbConn=DriverManager.getConnection(Yewu.jdbc);
stat=dbConn.createStatement();
StringBuffer del=new StringBuffer();
del.append("delete from anzhuangTab where kehuname='").append(kehunamet.getText().trim()).append("'");
if(stat.executeUpdate(del.toString())>0){
JOptionPane.showMessageDialog(null," 删除成功");
}
stat.close();
dbConn.close();
runchongzhi();
}catch(Exception ew){
System.out.println(ew);
JOptionPane.showMessageDialog(null,"数据库服务器是否启动");
}
}
}else if(e.getSource()==chongzhib){
runchongzhi();
}
}
private void runchongzhi(){
kehunamet.setText(null);
lianxitelt.setText(null);
bianhaot.setText(null);
guiget.setText(null);
yewuyuant.setText(null);
anzhuangyuant1.setText(null);
yibiaoxinghaot.setText(null);
yibiaobianhaot.setText(null);
chuanganqiMaxt.setText(null);
hao1.setText(null);
hao2.setText(null);
hao3.setText(null);
hao4.setText(null);
hao5.setText(null);
hao6.setText(null);
hao7.setText(null);
hao8.setText(null);
du1.setText(null);
du2.setText(null);
du3.setText(null);
du4.setText(null);
du5.setText(null);
du6.setText(null);
du7.setText(null);
du8.setText(null);
ji1.setText(null);
ji2.setText(null);
ji3.setText(null);
ji4.setText(null);
ji5.setText(null);
ji6.setText(null);
ji7.setText(null);
ji8.setText(null);
cha1.setText(null);
cha2.setText(null);
cha3.setText(null);
cha4.setText(null);
cha5.setText(null);
cha6.setText(null);
cha7.setText(null);
cha8.setText(null);
at.setText(null);
bt.setText(null);
c1t.setText(null);
c2t.setText(null);
c3t.setText(null);
c4t.setText(null);
d1t.setText(null);
d2t.setText(null);
et.setText(null);
ft.setText(null);
gt.setText(null);
jianchirent.setText(null);
jianchidatet.setText(null);
yibiaoht.setText(null);
yibiaoct.setText(null);
yibiaocht.setText(null);
caozuoyuant.setText(null);
telt.setText(null);
anzhuangriqit.setText(null);
tiaoshirent.setText(null);
tiaoshidatet.setText(null);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -