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

📄 addmovestoragetable_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 AddMoveStorageTable_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();
  QueryDataSet queryDataSet1 = new QueryDataSet();
  JLabel jLabel10 = new JLabel();
  JButton jButton3 = new JButton();
  JButton jButton4 = new JButton();
  JComboBox jComboBox4 = new JComboBox();
  JTextField jTextField8 = new JTextField();
  Column column1 = new Column();

  //Construct the frame
  public AddMoveStorageTable_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 AddMoveStorageTable_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,ComboBox2来显示仓库代码列表
    String warehousesSQL = "select whid from warehouses";
    buildC.load_Data(jComboBox1, warehousesSQL);
    buildC.load_Data(jComboBox3, warehousesSQL);

    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
        AddMoveStorageTable_Frm_jComboBox1_actionAdapter(this));
    jComboBox2.addActionListener(new
        AddMoveStorageTable_Frm_jComboBox2_actionAdapter(this));
    jTextField2.setText("");
    jComboBox3.addActionListener(new
        AddMoveStorageTable_Frm_jComboBox3_actionAdapter(this));
    jTextField6.setText("");
    jButton1.setText("添加");
    jButton1.addActionListener(new
                               AddMoveStorageTable_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("");
    jTextField4.addActionListener(new
        AddMoveStorageTable_Frm_jTextField4_actionAdapter(this));
    jTextField5.setText("");
    jButton2.setText("刷新");
    jButton2.addActionListener(new
                               AddMoveStorageTable_Frm_jButton2_actionAdapter(this));
    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.msprice as \"价格\",s.msamount as \"数量\",s.oldWhId as \"源仓库\",s.oldWsId " +
      "as \"货位\",s.newWhId as \"目标仓库\",s.newWsId as \"货位\"  FROM GoodsInfo g,msGoods " +
      "s where g.goodsid=s.goodsid and s.msid=:msid", parameterRow1, true, Load.ALL));
    jdbTable1.setDataSet(queryDataSet1);
    jLabel10.setForeground(Color.red);
    jLabel10.setText("添加后请按刷新");
    jButton3.setText("返回");
    jButton3.addActionListener(new
                               AddMoveStorageTable_Frm_jButton3_actionAdapter(this));
    jButton4.setText("调库");
    jButton4.addActionListener(new
                               AddMoveStorageTable_Frm_jButton4_actionAdapter(this));
    jComboBox4.addActionListener(new
        AddMoveStorageTable_Frm_jComboBox4_actionAdapter(this));
    jComboBox2.addMouseListener(new
                                AddMoveStorageTable_Frm_jComboBox2_mouseAdapter(this));
    jComboBox4.addMouseListener(new
                                AddMoveStorageTable_Frm_jComboBox4_mouseAdapter(this));
    column1.setColumnName("msid");
    column1.setDataType(com.borland.dx.dataset.Variant.INT);
    column1.setPreferredOrdinal(0);
    column1.setServerColumnName("NewColumn1");
    column1.setSqlType(0);
    parameterRow1.setColumns(new Column[] {column1});
    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(jTextField2, new XYConstraints(124, 11, 76, -1));
    jPanel2.add(tableScrollPane1, new XYConstraints(5, 111, 550, 163));
    jPanel2.add(jLabel8, new XYConstraints(21, 84, -1, -1));
    jPanel2.add(jTextField7, new XYConstraints(74, 81, 366, -1));
    jPanel2.add(jTextField5, new XYConstraints(457, 10, 98, -1));
    jPanel2.add(jLabel6, new XYConstraints(401, 13, -1, -1));
    jPanel2.add(jLabel5, new XYConstraints(401, 50, -1, -1));
    jPanel2.add(jTextField4, new XYConstraints(457, 47, 76, -1));
    jPanel2.add(jLabel7, new XYConstraints(21, 50, -1, -1));
    jPanel2.add(jLabel9, new XYConstraints(206, 50, -1, -1));
    jPanel2.add(jComboBox3, new XYConstraints(74, 47, 47, -1));
    jPanel2.add(jComboBox4, new XYConstraints(237, 47, 47, -1));
    jPanel2.add(jTextField8, new XYConstraints(299, 47, 76, -1));
    jPanel2.add(jTextField3, new XYConstraints(299, 10, 76, -1));
    jPanel2.add(jComboBox2, new XYConstraints(237, 10, 47, -1));
    jPanel2.add(jComboBox1, new XYConstraints(74, 11, 47, -1));
    jPanel2.add(jLabel3, new XYConstraints(21, 13, -1, -1));
    jPanel2.add(jLabel4, new XYConstraints(206, 13, -1, -1));
    jPanel2.add(jTextField6, new XYConstraints(124, 47, 76, -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(439, 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 warehouseid = (String) jComboBox3.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));
        jTextField6.setText(whname);
        jComboBox4.removeAllItems();
        //实现ComboBox4来显示仓库代码列表
        CbShowList buildC = new CbShowList();
        String stallsSQL = "select wsid from warehousestalls where whid='" +
            warehouseid + "'";
        buildC.load_Data(jComboBox4, stallsSQL);
      }
    }
    catch (Exception ex1) {
    }
  }

  void jButton1_actionPerformed(ActionEvent e) {
    String msid = jTextField1.getText();
    String oldwhid = (String) jComboBox1.getSelectedItem();
    String oldwsid = (String) jComboBox2.getSelectedItem();
    String newwhid = (String) jComboBox3.getSelectedItem();
    String newwsid = (String) jComboBox4.getSelectedItem();
    String[] paraStr = new String[] {
        msid, oldwhid, oldwsid, newwhid, newwsid
    };
    ErrorCheck errmsg = new ErrorCheck();
    if (errmsg.isNum(msid) && !errmsg.isEmpty(oldwhid) && !errmsg.isEmpty(oldwsid) &&
        !errmsg.isEmpty(newwhid) && !errmsg.isEmpty(newwsid)) {
      ResultSet rs = null;
      ConnectDBBean conn = new ConnectDBBean();
      //sql语句
      String sql = "select * from movestorage where msid='" +
          msid + "'";
      try {
        rs = conn.executeQuery(sql);
        if (rs.next()) {
          JOptionPane.showMessageDialog(null, "该单据编号已存在,请重新输入!");
        }
        else {

          //实例化GetFrmCentershow,该类是由我们创建的用于实现窗口中心显示
          GetFrmCenterShow gfc = new GetFrmCenterShow();
          //实例化AddMoveGoods_Frm
          AddMoveGoods_Frm frame = new AddMoveGoods_Frm(paraStr);
          //让frame显示在屏幕中心
          gfc.get_center(frame);

⌨️ 快捷键说明

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