📄 yewuxinxi.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.swing.border.*;
import javax.swing.tree.*;
import javax.swing.tree.TreePath;
import javax.swing.tree.MutableTreeNode;
import java.util.regex.Pattern;//判断0-9
import java.util.regex.Matcher;//判断0-9
import java.text.DateFormat;
import java.text.SimpleDateFormat;
public class Yewuxinxi extends JFrame implements ActionListener,ItemListener,MouseListener{
private TreePath tpath=null;
private JMenuBar bar;
private JMenu fileMenu,chaxunMenu,yewuyeji,bangzhu;
private JMenuItem luruchailv,chaxun,luru,xiugai,shanchu,qiehuan,kehuxiangdan,tuichu,hetongxiangdan,yewuyuandangan,xiangxibeizhu,weipizhu,dangriweipizhu,yewutongji,bangzhuzhuti,guanyu,dangriyipizhu,lurutixing,dangyuetixing,jishufuwutongji;
private Container con=null;
private CardLayout card=null;
private JLabel label=null;
private JPanel pCenter,pp,ppleft;
private JScrollPane lurujsp,jsp;//主面板
private JTree tree=null;
private DefaultMutableTreeNode r;
private DefaultTreeModel model;
private DefaultMutableTreeNode root,child,chosen;
private String str=null;
//
private JLabel weixiuren,chuchangshijian,kehumingchengl,huichangshijian;
private JTextField weixiurent,kehumingchengt;
static JTextField chuchangshijiant,huichangshijiant;
private JTextArea kehubeizhu,weiuxiubeizhu,manyibeizhu;
private JCheckBox manyiBox,bumanyiBox;
//private JButton dangyue,weixiuhuib;
//DateChooserJButton weixiuchub=new DateChooserJButton(8);
Choice weixiuChocie;
String ss;
Box weixiuboxH;
//
public static byte type=1;//注:1代表 业务信息 2:代表 检尺 安装 调试 3:维修记录
//--------------------------------------------------主面板组件---------------------------=-
public static int flgg=1;//1 代表选客户名 2代表选联系人 下拉菜单
private JTextField huichangTime,kehumingcheng,dizhi,lianxiren,dianhua,chuanzhen,
xinghaot,qiandingrent,hetongzonget,zhifujinet,zhifuyuet,shoukuanrent;
public static JTextField chuchangTime,qiandingriqit,zhifuriqit,hetongqixiant;
private JLabel yewuyuanlb,quyulb,chuchangTimelb,huichangTimelb,kehumingchenglb,dizhilb,lianxirenlb,
dianhualb,chuanzhenlb,xinghao,qiandingriqi,qiandingren,hetongzonge,zhifujine,zhifuriqi,zhifuyue,shoukuanren,hetongqixian;
DateChooserJButton chuchang=new DateChooserJButton(1);
DateChooserJButton qiandingb=new DateChooserJButton(2);
DateChooserJButton zhifub=new DateChooserJButton(3);
DateChooserJButton qixianb=new DateChooserJButton(4);
public static Choice yewuyuan,chuchangChoice,kehuChoice;
private JTextArea beizhu,pizhu;
private JButton luruButton,chongzhiButton,huichangb,huichangtb,kehub,xiugaib,shanchub;
private String timestr=null;
private Font font;
private Font font1;
private String name="";
private String truename="";
private JCheckBox zhongdian,shibaiBox,zuofeiBox;
//--------------------------------111
private String nian[]={"全部","2006","2007","2008","2009","2010","2011","2012","2013","2014","2015","2016","2017"};
private String yue[]={"全部","01","02","03","04","05","06","07","08","09","10","11","12"};
private Choice nianChoice;
private Choice yueChoice;
private Choice selectChoice;
//----------------------------------111
private JLabel lab1,lab2,lab3,lab4,lab5,lab6,lab7,lab8,lab9,lab10,lab11,lab12,lab13,lab14,lab15,bag1,bag2;
private JTextField kehunamet,lianxitelt,bianhaot,guiget,yewuyuant,anzhuangyuant1,yibiaoxinghaot,yibiaobianhaot,chuanganqiMaxt,
hao1,hao2,hao3,hao4,hao5,hao6,hao7,hao8,
nei1,nei2,nei3,nei4,nei5,nei6,nei7,nei8,
du1,du2,du3,du4,du5,du6,du7,du8,
ji1,ji2,ji3,ji4,ji5,ji6,ji7,ji8,
cha1,cha2,cha3,cha4,cha5,cha6,cha7,cha8,
lab01,lab02,lab03,lab04,lab05,lab06,lab07,lab08;
private JLabel laba,labaa,labb,labbb,labc,labc1,labc2,labc3,labc4,labd,labd1,labd2,labe,labee,labf,labff,labg,labgg,labjianchi,jianchidate,tiaoshidate,tiaoshiren;
private JTextField tiaoshirent,tiaoshidatet,at,bt,c1t,c2t,c3t,c4t,d1t,d2t,et,ft,gt,jianchirent,jianchidatet;
private JLabel anzhuang31,anzhuang32,anzhuang33,caozuoyuan,tel,anzhuangriqi,anzhuangyuan;
private JTextField yibiaoht,yibiaoct,yibiaocht,caozuoyuant,telt,anzhuangriqit;
// private Font font;
private Choice jieshu;
JScrollPane jsppp;
//JButton lurub,xiugaib,shanchub,chongzhib;
//Luru ll;----------------------------------------------------------------------
public Yewuxinxi(String truename,String name){
super("临朐志永机电科技业务信息录入系统----当前登陆用户 "+name+"");
this.truename=truename;
this.name=name;
//-----------------------------------------------菜单---------------------------------------------------
chaxun=new JMenuItem("查询业务信息");
luru=new JMenuItem("录入业务信息");
luruchailv=new JMenuItem("录入差旅费用");
lurutixing=new JMenuItem("录入提醒信息");
xiugai=new JMenuItem("修改业务信息");
xiugai.setToolTipText("除回厂时间.客户名称外都可修改");
shanchu=new JMenuItem("删除业务信息");
shanchu.setToolTipText("将会删除选定的某条信息,包括该条的(基本信息.合同信息.业务备注.批注)");
qiehuan=new JMenuItem("切换登陆用户");
tuichu=new JMenuItem("退出系统");
hetongxiangdan=new JMenuItem("客户支付记录详单");
hetongxiangdan.setToolTipText("根据基本信息中的 |客户名称| 查询");
kehuxiangdan=new JMenuItem("客户资料详单");
kehuxiangdan.setToolTipText("可根据不同需要,设置查询条件");
yewuyuandangan=new JMenuItem("业务员档案");
yewuyuandangan.setToolTipText("根据基本信息中的 |业务员| 查询");
xiangxibeizhu=new JMenuItem("详细业务备注");
xiangxibeizhu.setToolTipText("根据基本信息中的 |客户名称| 查询,结果显示在业务备注区域");
weipizhu=new JMenuItem("所有未批注业务");
weipizhu.setToolTipText("将所有未批注业务列表,显示在客户名称右侧的下拉菜单中");
dangriweipizhu=new JMenuItem("当日未批注业务");
dangriweipizhu.setToolTipText("将当日未批注业务列表,显示在客户名称右侧的下拉菜单中");
dangyuetixing=new JMenuItem("当月全部信息提醒");
dangriyipizhu=new JMenuItem("当日已批注业务");
dangriyipizhu.setToolTipText("将当日已批注业务列表,显示在客户名称右侧的下拉菜单中");
yewutongji=new JMenuItem("销售业绩统计");
yewutongji.setToolTipText("对业务员的所有销售业绩进行统计");
jishufuwutongji=new JMenuItem("技术服务统计");
jishufuwutongji.setToolTipText("对检验,检尺,安装,维修进行统计");
bar=new JMenuBar();
fileMenu=new JMenu("菜单选项");
fileMenu.add(chaxun);
fileMenu.add(luru);
fileMenu.add(luruchailv);
fileMenu.add(lurutixing);
fileMenu.add(xiugai);
fileMenu.add(shanchu);
fileMenu.add(qiehuan);
fileMenu.add(tuichu);
chaxunMenu=new JMenu("查询选项");
chaxunMenu.add(hetongxiangdan);
chaxunMenu.add(yewuyuandangan);
chaxunMenu.add(xiangxibeizhu);
chaxunMenu.add(weipizhu);
chaxunMenu.add(dangriweipizhu);
chaxunMenu.add(dangriyipizhu);
chaxunMenu.add(dangyuetixing);
yewuyeji=new JMenu("统计查询");
yewuyeji.add(yewutongji);
yewuyeji.add(kehuxiangdan);
yewuyeji.add(jishufuwutongji);
bangzhu=new JMenu("帮助");
bangzhuzhuti=new JMenuItem("帮助主题");
bangzhuzhuti.setToolTipText("对常见问题的说明解释");
guanyu=new JMenuItem("关于信息");
guanyu.setToolTipText("关于本软件的版权");
bangzhu.add(bangzhuzhuti);
bangzhu.add(guanyu);
bar.add(fileMenu);
bar.add(chaxunMenu);
bar.add(yewuyeji);
bar.add(bangzhu);
setJMenuBar(bar);
////////////////////////////////////////////////////
font=new java.awt.Font("宋体",Font.PLAIN,14);
font1=new java.awt.Font("宋体",Font.PLAIN,16); //Label字体设置
run1();//调用run()1
nianChoice=new Choice();
yueChoice=new Choice();
selectChoice=new Choice();
if(name.equals("master")||name.equals("root")){
runtree("select yewuname,kehuname from yewuTab where hetong='0' and zhongdian='0' group by yewuname,kehuname "); //初始化树结构
selectChoice.add("◆ 普通信息 ◆");
selectChoice.add("◆ 重点信息 ◆");
selectChoice.add("◆未批注信息◆");
selectChoice.add("◆到期未结清◆");
selectChoice.add("◆货款未结清◆");
selectChoice.add("◆已签订合同◆");
selectChoice.add("◆货款已结清◆");
selectChoice.add("★ 维修记录 ★");
selectChoice.add("★不满意客户★");
selectChoice.add("★已安装完毕★");
selectChoice.add("★检尺待安装★");
selectChoice.add("▲作废合同案例▲");
selectChoice.add("▲竞争失败案例▲");
selectChoice.add("◆当日已批注◆");
}else if(name.equals("serve")){
runtree("select yewuname,kehuname from hetongTable group by yewuname,kehuname" );//
selectChoice.add("◆已签订合同◆");
selectChoice.add("★ 维修记录 ★");
selectChoice.add("★不满意客户★");
selectChoice.add("★已安装完毕★");
selectChoice.add("★检尺待安装★");
}else{
runtree("select yewuname,kehuname from yewuTab where yewuname='"+truename+"'");//初始化树结构
}
selectChoice.setFont(font);
nianChoice.setFont(font);
yueChoice.setFont(font);
yueChoice.setEnabled(false);
for(int i=0;i<nian.length;i++){
nianChoice.add(nian[i].toString());
yueChoice.add(yue[i].toString());
}
chaxun.addActionListener(this);
luru.addActionListener(this);
luruchailv.addActionListener(this);
xiugai.addActionListener(this);
qiehuan.addActionListener(this);
tuichu.addActionListener(this);
hetongxiangdan.addActionListener(this);
xiangxibeizhu.addActionListener(this);
weipizhu.addActionListener(this);
dangriweipizhu.addActionListener(this);
yewuyuandangan.addActionListener(this);
yewutongji.addActionListener(this);
bangzhuzhuti.addActionListener(this);
guanyu.addActionListener(this);
kehuxiangdan.addActionListener(this);
dangriyipizhu.addActionListener(this);
lurutixing.addActionListener(this);
dangyuetixing.addActionListener(this);
nianChoice.addItemListener(this);
selectChoice.addItemListener(this);
jishufuwutongji.addActionListener(this);
if(!name.equals("master")){
weipizhu.setEnabled(false);
shanchu.setEnabled(false);
dangriweipizhu.setEnabled(false);
}
if(!name.equals("master")&&!name.equals("root")){
weipizhu.setEnabled(false);
shanchu.setEnabled(false);
xiugai.setEnabled(false);
dangriweipizhu.setEnabled(false);
yewutongji.setEnabled(false);
jishufuwutongji.setEnabled(false);
xiangxibeizhu.setEnabled(false);
kehuxiangdan.setEnabled(false);
dangriyipizhu.setEnabled(false);
hetongxiangdan.setEnabled(false);
dangriweipizhu.setEnabled(false);
}
JPanel ppto=new JPanel();
ppto.add(nianChoice);
ppto.add(yueChoice);
ppto.add(selectChoice);
ppleft=new JPanel();
ppleft.setLayout(new BorderLayout());
jsp=new JScrollPane(tree);
ppleft.add(ppto,BorderLayout.SOUTH);
ppleft.add(jsp,BorderLayout.CENTER);
con=getContentPane();
con.setLayout(new BorderLayout());
con.add(ppleft,BorderLayout.WEST);
con.add(lurujsp,BorderLayout.CENTER);
con.validate();
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
System.exit(0);
}
});
//-------全屏显示----------------------------------------------------
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Rectangle bounds =new Rectangle(screenSize);
Insets insets=Toolkit.getDefaultToolkit().getScreenInsets(this.getGraphicsConfiguration());
bounds.x += insets.left;
bounds.y += insets.top;
bounds.width -= insets.left + insets.right;
bounds.height -= insets.top + insets.bottom;
setBounds(bounds);
setVisible(true);
setDefaultCloseOperation(this.EXIT_ON_CLOSE);
validate();
//---------------------------------------------
}
public void run3(){
weixiuren=new JLabel("维修人:");
chuchangshijian=new JLabel("出厂:");
huichangshijian=new JLabel("回厂:");
kehumingchengl=new JLabel("客户名:");
kehumingchengt=new JTextField(5);
kehumingchengt.setEditable(false);
weixiurent=new JTextField(5);
chuchangshijiant=new JTextField(5);
huichangshijiant=new JTextField(5);
manyiBox=new JCheckBox("客户很满意 ");
bumanyiBox=new JCheckBox("客户不满意");
// weixiuhuib=new JButton("当前时间");
weixiuChocie=new Choice();
weixiuChocie.add(" .");
Box box1=Box.createHorizontalBox();
box1.add(kehumingchengl);
box1.add(kehumingchengt);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -