⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addinstoragetable_frm.java

📁 库存管理信息系统
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
package KcglSys;

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;
import com.borland.dbswing.*;
import com.borland.dx.sql.dataset.*;
import java.sql.*;
import javax.swing.border.*;
import com.borland.dx.dataset.*;

/**
 * <p>Title: 库存管理信息系统</p>
 * <p>Description: 库存管理信息系统,企业好帮手</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: ios</p>
 * @author dragon
 * @version 1.0
 */

public class AddInStorageTable_Frm
    extends JFrame {
  JPanel contentPane;
  XYLayout xYLayout1 = new XYLayout();
  JPanel jPanel1 = new JPanel();
  XYLayout xYLayout2 = new XYLayout();
  JLabel jLabel1 = new JLabel();
  JLabel jLabel2 = new JLabel();
  JTextField jTextField1 = new JTextField();
  JPanel jPanel2 = new JPanel();
  JLabel jLabel3 = new JLabel();
  XYLayout xYLayout3 = new XYLayout();
  JTextField jTextField2 = new JTextField();
  JComboBox jComboBox1 = new JComboBox();
  JLabel jLabel4 = new JLabel();
  JComboBox jComboBox2 = new JComboBox();
  JTextField jTextField3 = new JTextField();
  JLabel jLabel5 = new JLabel();
  JTextField jTextField4 = new JTextField();
  JLabel jLabel6 = new JLabel();
  JTextField jTextField5 = new JTextField();
  JLabel jLabel7 = new JLabel();
  JTextField jTextField6 = new JTextField();
  JLabel jLabel8 = new JLabel();
  JTextField jTextField7 = new JTextField();
  TableScrollPane tableScrollPane1 = new TableScrollPane();
  JdbTable jdbTable1 = new JdbTable();
  JComboBox jComboBox3 = new JComboBox();
  JLabel jLabel9 = new JLabel();
  Database database1 = new Database();
  JButton jButton1 = new JButton();
  JdbNavToolBar jdbNavToolBar1 = new JdbNavToolBar();
  Border border1;
  JButton jButton2 = new JButton();
  ParameterRow parameterRow1 = new ParameterRow();
  Column column1 = new Column();
  QueryDataSet queryDataSet1 = new QueryDataSet();
  JLabel jLabel10 = new JLabel();
  JButton jButton3 = new JButton();
  JButton jButton4 = new JButton();

  //Construct the frame
  public AddInStorageTable_Frm() {
    enableEvents(AWTEvent.WINDOW_EVENT_MASK);
    try {
      jbInit();
    }
    catch (Exception e) {
      e.printStackTrace();
    }
  }

  //Component initialization
  private void jbInit() throws Exception {
    contentPane = (JPanel)this.getContentPane();
    border1 = BorderFactory.createLineBorder(Color.black, 2);
    contentPane.setLayout(xYLayout1);
    this.setSize(new Dimension(620, 445));
    this.setTitle("入库单编辑");
    this.addMouseListener(new AddInStorageTable_Frm_this_mouseAdapter(this));
    jPanel1.setBackground(UIManager.getColor("inactiveCaption"));
    jPanel1.setBorder(BorderFactory.createLineBorder(Color.black));
    jPanel1.setLayout(xYLayout2);
    jLabel1.setFont(new java.awt.Font("Dialog", 1, 20));
    jLabel1.setForeground(Color.black);
    jLabel1.setHorizontalAlignment(SwingConstants.CENTER);
    jLabel1.setHorizontalTextPosition(SwingConstants.CENTER);
    jLabel1.setText("货 物 入 库 单");
    jLabel2.setText("单据编号");
    jPanel2.setBackground(UIManager.getColor("inactiveCaption"));
    jPanel2.setBorder(BorderFactory.createLineBorder(Color.black));
    jPanel2.setDebugGraphicsOptions(0);
    jPanel2.setLayout(xYLayout3);
    //实例化CbShowList
    CbShowList buildC = new CbShowList();
    //实现ComboBox1来显示仓库代码列表
    String warehousesSQL = "select whid from warehouses";
    buildC.load_Data(jComboBox1, warehousesSQL);
    //实现ComboBox3来显示供方编号列表
    String providerSQL = "select proid from providersinfo";
    buildC.load_Data(jComboBox3, providerSQL);

    jLabel3.setText("库 房");
    jLabel4.setText("货 位");
    jLabel5.setText("入库人");
    jLabel6.setText("入库日期");
    jLabel7.setText("供方编号");
    jLabel8.setText("单据备注");
    tableScrollPane1.setBorder(BorderFactory.createLineBorder(Color.black));
    jLabel9.setText("名 称");
    database1.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor(
        "jdbc:odbc:KcglSys", "sa", "sa", false, "sun.jdbc.odbc.JdbcOdbcDriver"));
    jComboBox1.addActionListener(new
                                 AddInStorageTable_Frm_jComboBox1_actionAdapter(this));
    jComboBox2.addActionListener(new
                                 AddInStorageTable_Frm_jComboBox2_actionAdapter(this));
    jTextField2.setText("");
    jComboBox3.addActionListener(new
                                 AddInStorageTable_Frm_jComboBox3_actionAdapter(this));
    jTextField6.setText("");
    jButton1.setText("添加");
    jButton1.addActionListener(new AddInStorageTable_Frm_jButton1_actionAdapter(this));
    jdbNavToolBar1.setBackground(UIManager.getColor("inactiveCaption"));
    jdbNavToolBar1.setBorder(BorderFactory.createLineBorder(Color.black));
    jdbNavToolBar1.setButtonStateInsert(JdbNavToolBar.HIDDEN);
    jdbNavToolBar1.setButtonStatePost(JdbNavToolBar.HIDDEN);
    jdbNavToolBar1.setButtonStateCancel(JdbNavToolBar.HIDDEN);
    jTextField1.setText("");
    jTextField4.setText("");
    jTextField5.setText("");
    jButton2.setText("刷新");
    jButton2.addActionListener(new AddInStorageTable_Frm_jButton2_actionAdapter(this));
    column1.setCalcType(com.borland.dx.dataset.CalcType.NO_CALC);    column1.setCaption("isid");    column1.setColumnName("isid");
    column1.setDataType(com.borland.dx.dataset.Variant.INT);
    column1.setPreferredOrdinal(0);
    column1.setServerColumnName("NewColumn1");
    column1.setSqlType(0);
    parameterRow1.setColumns(new Column[] {column1});
    queryDataSet1.setEnableInsert(false);
    queryDataSet1.setQuery(new com.borland.dx.sql.dataset.QueryDescriptor(database1, "SELECT s.GoodsId AS \"货物代码\",g.GName AS \"名称\",g.GStyle AS \"型号\",g.GUnit " +      "AS \"计量单位\",s.isprice as \"价格\",s.isamount as \"数量\",s.WhId as \"仓库\",s.WsId " +      "as \"货位\"  FROM GoodsInfo g,IsGoods s where g.goodsid=s.goodsid and " +      "s.isid=:isid", parameterRow1, true, Load.ALL));
    jdbTable1.setDataSet(queryDataSet1);
    jLabel10.setForeground(Color.red);
    jLabel10.setText("添加后请按刷新");
    jButton3.setText("返回");
    jButton3.addActionListener(new AddInStorageTable_Frm_jButton3_actionAdapter(this));
    jButton4.setText("入库");
    jButton4.addActionListener(new AddInStorageTable_Frm_jButton4_actionAdapter(this));
    jComboBox2.addMouseListener(new
                                AddInStorageTable_Frm_jComboBox2_mouseAdapter(this));
    contentPane.add(jPanel1, new XYConstraints(15, 15, 580, 362));
    jPanel1.add(jLabel1, new XYConstraints(182, 9, 234, 32));
    jPanel1.add(jTextField1, new XYConstraints(67, 15, 69, -1));
    jPanel1.add(jLabel2, new XYConstraints(15, 19, -1, -1));
    jPanel1.add(jPanel2, new XYConstraints(8, 42, 561, 282));
    jPanel2.add(jComboBox1, new XYConstraints(56, 11, 58, -1));
    jPanel2.add(jComboBox2, new XYConstraints(56, 46, 58, -1));
    jPanel2.add(jTextField3, new XYConstraints(118, 46, 76, -1));
    jPanel2.add(jLabel7, new XYConstraints(215, 49, -1, -1));
    jPanel2.add(jLabel3, new XYConstraints(22, 14, -1, -1));
    jPanel2.add(jLabel4, new XYConstraints(22, 49, -1, -1));
    jPanel2.add(jTextField2, new XYConstraints(118, 11, 76, -1));
    jPanel2.add(jTextField4, new XYConstraints(257, 11, 76, -1));
    jPanel2.add(jLabel5, new XYConstraints(215, 14, -1, -1));
    jPanel2.add(jLabel6, new XYConstraints(358, 14, -1, -1));
    jPanel2.add(jTextField5, new XYConstraints(412, 11, 131, -1));
    jPanel2.add(tableScrollPane1, new XYConstraints(5, 111, 550, 163));
    jPanel2.add(jLabel8, new XYConstraints(21, 84, -1, -1));
    jPanel2.add(jComboBox3, new XYConstraints(268, 46, 58, -1));
    jPanel2.add(jLabel9, new XYConstraints(332, 49, -1, -1));
    jPanel2.add(jTextField6, new XYConstraints(363, 46, 76, -1));
    jPanel2.add(jTextField7, new XYConstraints(74, 81, 366, -1));
    jPanel1.add(jdbNavToolBar1, new XYConstraints(8, 323, -1, 38));
    jPanel1.add(jButton1, new XYConstraints(317, 331, -1, 20));
    jPanel1.add(jButton2, new XYConstraints(394, 331, -1, 20));
    jPanel1.add(jLabel10, new XYConstraints(465, 332, 100, 17));
    contentPane.add(jButton3, new XYConstraints(524, 384, -1, 23));
    contentPane.add(jButton4, new XYConstraints(440, 384, -1, 23));
    tableScrollPane1.getViewport().add(jdbTable1, null);
  }

  //Overridden so we can exit when window is closed
  protected void processWindowEvent(WindowEvent e) {
    super.processWindowEvent(e);
    if (e.getID() == WindowEvent.WINDOW_CLOSING) {
      this.dispose();
    }
  }

  void jComboBox1_actionPerformed(ActionEvent e) {
    String warehouseid = (String) jComboBox1.getSelectedItem();
    ResultSet rs = null;
    //实例化ConnectDBBean
    ConnectDBBean conndb = new ConnectDBBean();
    //sql查询语句
    String sql =
        "select whname from warehouses  where whid='" +
        Integer.parseInt(warehouseid) + "'";
    try {
      rs = conndb.executeQuery(sql);
      if (rs.next()) {
        String whname = String.valueOf(rs.getString(1));
        jTextField2.setText(whname);
        jComboBox2.removeAllItems();
        //实现ComboBox2来显示仓库代码列表
        CbShowList buildC = new CbShowList();
        String stallsSQL = "select wsid from warehousestalls where whid='" +
            warehouseid + "'";
        buildC.load_Data(jComboBox2, stallsSQL);
      }
    }
    catch (Exception ex1) {
    }

  }

  void jComboBox2_actionPerformed(ActionEvent e) {
  }

  void this_mouseClicked(MouseEvent e) {
  }

  void jComboBox3_actionPerformed(ActionEvent e) {
    String providerid = (String) jComboBox3.getSelectedItem();
    ResultSet rs = null;
    //实例化ConnectDBBean
    ConnectDBBean conndb = new ConnectDBBean();
    //sql查询语句
    String sql =
        "select proname from providersinfo  where proid='" +
        Integer.parseInt(providerid) + "'";
    try {
      rs = conndb.executeQuery(sql);
      if (rs.next()) {
        String proname = String.valueOf(rs.getString(1));
        jTextField6.setText(proname);
      }
    }
    catch (Exception ex1) {
    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -