RF的JAVA程序


import java.sql.*;

import javax.naming.*;
import javax.sql.DataSource;

import oracle.jdbc.driver.OracleDriver;
//modify by luoyanqing 2009.03.17
public class DataBaseConnection {
//
 public static Connection getConnction() throws Exception {
  Connection con = null;
  
  try {
   Context ctx=new InitialContext();
   //DataSource ds=(DataSource)ctx.lookup("java:comp/env/jdbc/rf");
//   con=ds.getConnection();
   Class.forName("oracle.jdbc.driver.OracleDriver");
   con = DriverManager.getConnection(
     "jdbc:oracle:thin:@192.168.100.105:1521:orcl", "mestest", "mestest");//测试
//           "jdbc:oracle:thin:@192.168.100.100:1521:mes", "mes", "shinwames");//生产
  } catch (Exception e) {
   e.printStackTrace();
   e.getStackTrace();
  }
  System.out.println("con=="+con);
  return con;
 }
}
==================================================

 

import java.sql.CallableStatement;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;

public class ExecuteProcedure {
 //机台上料
 /*
  * 功能:机台上料时,对任务令,栈位,槽位,区位等进行解析校验。
     * create by luoyanqing 2009.03.17
  */
 public String Batchsetupinfo(
                         String PI_USER,  // 操作员
                         String PI_LINE_NO,     //线体编码
                         String PI_MACHINE_CODE , //机器编码
                         float PI_TRACK_NO ,  //栈位编码
                         float PI_DIVISION_NUM,//槽位编号
                         String PI_PSN_09, //物料PSN或09
                         float  PI_SETUP_QTY //    上料数量
    )
 throws Exception{
  String result1 = "";
  String result2="";
  String result3="";
  String result4 = "";
  String result5 = "";
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try{
   CallableStatement cst_audit = null;
   String audit = "{call PRC_BATCH_SETUP_INFO(?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,PI_USER);
   cst_audit.setString(2,PI_LINE_NO);
   cst_audit.setString(3,PI_MACHINE_CODE);
   cst_audit.setFloat(4, PI_TRACK_NO);
   cst_audit.setFloat(5,PI_DIVISION_NUM);
   cst_audit.setString(6,PI_PSN_09);
   cst_audit.setFloat(7,PI_SETUP_QTY);
   cst_audit.registerOutParameter(8,Types.VARCHAR);//返回信息String.valueOf
   cst_audit.registerOutParameter(9,Types.VARCHAR);//栈位
   cst_audit.registerOutParameter(10,Types.VARCHAR);//槽位
   cst_audit.registerOutParameter(11,Types.VARCHAR);//是否批转的物料提示
   cst_audit.registerOutParameter(12,Types.VARCHAR);//本次料是否全部完成
   cst_audit.execute();
   result1 = "001["+String.valueOf(cst_audit.getString(8));
   //result2 = "002["+String.valueOf(cst_audit.getString(11));
   //result3 = "003["+String.valueOf(cst_audit.getString(12));
   result2 = "["+String.valueOf(cst_audit.getString(9));
   result3 = "["+String.valueOf(cst_audit.getString(10));
   result4 = "["+String.valueOf(cst_audit.getString(11));
   result5 = "["+String.valueOf(cst_audit.getString(12));
   results = result1+result2+result3+result4+result5;
  }finally{
   if (conn != null){
    try{
     conn.close();
    }catch(SQLException e){
     e.printStackTrace();
    }
   }
  }
  return results;
  
 }
 
//=========================================
 //校验PSN,返回数量
 /*
  * 功能:校验PSN,返回数量
  *  create by luoyanqing 2009.03.17
  */
 
 public String checkpsn(String PI_PSN) throws Exception {
  String results1= "";
  String results2 = "";
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_BATCH_GET_ITEM_QTY(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,PI_PSN);
   cst_audit.registerOutParameter(2, Types.INTEGER);
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   results1 = "001["+String.valueOf(cst_audit.getInt(2));
   results2 = "["+String.valueOf(cst_audit.getString(3));
   results =  results1+results2;
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }
 
 //机台接料
 /*
  * 功能:机台接料时,输入任务令,栈位,槽位,区位等进行解析校验。
     * create by luoyanqing 2009.03.17
  */
 public String receivemeta(
                         String PI_USER,  // 操作员
                         String PI_LINE_NO,     //线体编号
                         String PI_MACHINE_CODE, //机器编码
                         float  PI_TRACK_NO ,  //栈位编码
                         float  PI_DIVISION_NUM,//槽位编号
                         String PI_PSN_09, //物料PSN或09
                         float  PI_SETUP_QTY, //    上料数量
                         float  PI_WASTE_QTY  //    浪费数量
    )
 throws Exception{
  String result = "";
  
  Connection conn = DataBaseConnection.getConnction();
  try{
   CallableStatement cst_audit = null;
   String audit = "{call PRC_BATCH_SETUP_ONLINE(?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,PI_USER);// 操作员
   cst_audit.setString(2,PI_LINE_NO);//线体编号
   cst_audit.setString(3,PI_MACHINE_CODE);//机器编码
   cst_audit.setFloat (4,PI_TRACK_NO);  //栈位编码
   cst_audit.setFloat(5,PI_DIVISION_NUM);//槽位编号
   cst_audit.setString (6,PI_PSN_09);   //物料PSN或09
   cst_audit.setFloat (7,PI_SETUP_QTY);//    上料数量
   cst_audit.setFloat (8,PI_WASTE_QTY);//    浪费数量
   cst_audit.registerOutParameter(9,Types.VARCHAR);//返回信息
   cst_audit.registerOutParameter(10,Types.VARCHAR);//返回信息
   cst_audit.execute();
   result = "001["+cst_audit.getString(9);
   result = result+"["+cst_audit.getString(10);
  }finally{
   if (conn != null){
    try{
     conn.close();
    }catch(SQLException e){
     e.printStackTrace();
    }
   }
  }
  return result;
  
 }
 //扫机台条码自动带第一个槽位和栈位。
 /*
  * 功能:扫机台条码自动带第一个槽位和栈位。
  *  create by luoyanqing 2009.03.17
  */
 
 public String receivediv(
            String PI_LINE_NO,  //线体编号
            String PI_MACHINE_CODE     //机台条码
            //String PI_SETUP_NO
 )
throws Exception{
String result1 = "";
String result2 = "";
String result3 = "";
String results = "";

Connection conn = DataBaseConnection.getConnction();
try{
CallableStatement cst_audit = null;
String audit = "{call PRC_BATCH_GET_TRK_DIV(?,?,?,?,?)}";
cst_audit = conn.prepareCall(audit);
cst_audit.setString(1,PI_LINE_NO);
cst_audit.setString(2,PI_MACHINE_CODE);
//cst_audit.setString(3,PI_SETUP_NO);//机器编码
cst_audit.registerOutParameter(3,Types.VARCHAR);//返回信息
cst_audit.registerOutParameter(4,Types.VARCHAR);//返回信息
cst_audit.registerOutParameter(5,Types.VARCHAR);//返回信息
cst_audit.execute();
result1 = "001["+cst_audit.getString(3);
result2 = "["+cst_audit.getString(4);
result3 = "["+cst_audit.getString(5);
results = result1+result2+result3;
}finally{
if (conn != null){
try{
     conn.close();
   }catch(SQLException e){
  e.printStackTrace();
  }
 }
}
return results;

}

 // 查询漏扫记录
 //* create by luoyanqing 2009.03.29
 public String psQuery(String PI_LINE_NO) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_BATCH_GET_MISS_SETUP(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, PI_LINE_NO);// 线体编号
   //cst_audit.setString(2, PI_SETUP_NO);// 上料表编号
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   results = "001"+cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }
//替代料位置查询
/*
 * 功能:根据原盘条码查找上料位置。
 * create by luoyanqing 2009.04.8
*/
 public String checkbeforepsn(
            String PI_LINE_NO,  //线体编号
            String PI_PSN_09    //psn或09条码
 )
throws Exception{
String result1 = "";
String result2 = "";
String result3 = "";
String result4 = "";
String result5 = "";
String results = "";

Connection conn = DataBaseConnection.getConnction();
try{
CallableStatement cst_audit = null;
String audit = "{call PRC_BATCH_GET_PSN_TRK_DIV(?,?,?,?,?,?,?)}";
cst_audit = conn.prepareCall(audit);
cst_audit.setString(1,PI_LINE_NO);
cst_audit.setString(2,PI_PSN_09);
cst_audit.registerOutParameter(3,Types.VARCHAR);//返回机台编码
cst_audit.registerOutParameter(4,Types.VARCHAR);//返回下一个需要上料的栈位
cst_audit.registerOutParameter(5,Types.VARCHAR);//返回下一个需要上料的槽位
cst_audit.registerOutParameter(6,Types.VARCHAR);//返回该位置剩余的数量
cst_audit.registerOutParameter(7,Types.VARCHAR);//返回信息
cst_audit.execute();
result1 = "001["+cst_audit.getString(7);
result2 = "["+cst_audit.getString(3);
result3 = "["+cst_audit.getString(4);
result4 = "["+cst_audit.getString(5);
result5 = "["+cst_audit.getString(6);
results = result1+result2+result3+result4+result5;
}finally{
if (conn != null){
try{
     conn.close();
   }catch(SQLException e){
  e.printStackTrace();
  }
 }
}
return results;

}


 
//===============================================================================
 //线体切换
 /*
  * 功能:将上料表及相关信息切换到其它线体上
  */
 public String lineChange(String c_setup_no,String c_line_no)throws Exception{
  String result = "";
  Connection conn = DataBaseConnection.getConnction();
  try{
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_Q1_lineswitch(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,c_setup_no);
   cst_audit.setString(2,c_line_no);
   cst_audit.registerOutParameter(3,Types.VARCHAR);
   cst_audit.execute();
   result = cst_audit.getString(3);
  }finally{
   if (conn != null){
    try{
     conn.close();
    }catch(SQLException e){
     e.printStackTrace();
    }
   }
  }
  return result;
 }
    //*********************上料位置调整**************************//
 //上料位置调整--确认
 
 public String trackModify(String c_user_no,
          int c_old_feerder_id,
          int n_slot_qty,
          String c_Setup_No,
          String c_Line_No,
          String c_Line_Type,
          String c_model_No,
          String c_loca_No,
          String c_track_No,
          String c_table_1,
          String c_table_2,
          String c_table_3,
          int c_feeder_id_1,int c_feeder_id_2,int c_feeder_id_3,
          String c_model_1,String c_model_2,String c_model_3,
          String c_loca_1,String c_loca_2,String c_loca_3,
          String c_track_1,String c_track_2,String c_track_3,
          String c_div_1,String c_div_2,String c_div_3,
          String c_Item_Code_1,String c_Item_Code_2,String c_Item_Code_3,
          String c_Item_BCode_1,String c_Item_BCode_2,String c_Item_BCode_3,
          String c_Item_lot_1,String c_Item_lot_2,String c_Item_lot_3,
          int n_qty_1,int n_qty_2,int n_qty_3)throws Exception{
  String result = "";
  Connection conn = DataBaseConnection.getConnction();
  try{
   CallableStatement cst_audit = null;
   String audit ="{call prc_rf_P4_Track_Modify(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,c_user_no);
   cst_audit.setInt(2,c_old_feerder_id);
   cst_audit.setInt(3,n_slot_qty);
   cst_audit.setString(4,c_Setup_No);
   cst_audit.setString(5,c_Line_No);
   cst_audit.setString(6,c_Line_Type);
   cst_audit.setString(7,c_model_No);
   cst_audit.setString(8,c_loca_No);
   cst_audit.setString(9,c_track_No);
   cst_audit.setString(10,c_table_1);
   cst_audit.setString(11,c_table_2);
   cst_audit.setString(12,c_table_3);
   cst_audit.setInt(13,c_feeder_id_1);
   cst_audit.setInt(14,c_feeder_id_2);
      cst_audit.setInt(15,c_feeder_id_3);
      cst_audit.setString(16,c_model_1);
      cst_audit.setString(17,c_model_2);
      cst_audit.setString(18,c_model_3);
      cst_audit.setString(19,c_loca_1);
      cst_audit.setString(20,c_loca_2);
      cst_audit.setString(21,c_loca_3);
      cst_audit.setString(22,c_track_1);
      cst_audit.setString(23,c_track_2);
      cst_audit.setString(24,c_track_3);
      cst_audit.setString(25,c_div_1);
      cst_audit.setString(26,c_div_2);
      cst_audit.setString(27,c_div_3);
      cst_audit.setString(28,c_Item_Code_1);
      cst_audit.setString(29,c_Item_Code_2);
      cst_audit.setString(30,c_Item_Code_3);
      cst_audit.setString(31,c_Item_BCode_1);
      cst_audit.setString(32,c_Item_BCode_2);
      cst_audit.setString(33,c_Item_BCode_3);
      cst_audit.setString(34,c_Item_lot_1);
      cst_audit.setString(35,c_Item_lot_2);
      cst_audit.setString(36,c_Item_lot_3);
      cst_audit.setInt(37,n_qty_1);
      cst_audit.setInt(38,n_qty_2);
      cst_audit.setInt(39,n_qty_3);
   cst_audit.registerOutParameter(40,Types.VARCHAR);
   cst_audit.execute();
   result = cst_audit.getString(40);
  }
  finally{
   if (conn!=null){
    try{
     conn.close();
    }
    catch(SQLException e){
     e.printStackTrace();
    }
   }
  }
  return result;
 }
 
 //上料位置调整--物料条码校验
 public String verifyMater(String c_item_Code,
        String c_new_item_BCode,
        String c_Division_index,
        String c_qty,
        String c_Task_No)throws Exception{
  String result = "";
  Connection conn = DataBaseConnection.getConnction();
  try{
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_P3_Track_Modify(?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,c_item_Code);
   cst_audit.setString(2,c_new_item_BCode);
   cst_audit.setString(3,c_Division_index);
   cst_audit.setString(4,c_qty);
   cst_audit.setString(5,c_Task_No);
   cst_audit.registerOutParameter(6,Types.VARCHAR);
   cst_audit.execute();
   result = cst_audit.getString(6);
  }
  finally{
   if (conn!=null){
    try{
     conn.close();
    }
    catch(SQLException e){
     e.printStackTrace();
    }
   }
  }
  return result;
 } 
 
 //上料位置调整--验证新飞达及分区
 public String verifyNewFeder(
   String c_model_No_Old,
   String c_Loca_No_Old,
   String c_Track_No_Old,
   String c_Line_No,
   String c_model_No,
   String c_Loca_No,
   String c_Track_No,
   String c_Division_No,
   String c_setup_no,
   String c_New_Feeder_Code,
   String c_Old_Feeder_Code
   )throws Exception{
  String result = "";
  Connection conn = DataBaseConnection.getConnction();
  try{
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_P2_Track_Modify(?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,c_model_No_Old);
   cst_audit.setString(2,c_Loca_No_Old);
   cst_audit.setString(3,c_Track_No_Old);
   cst_audit.setString(4,c_Line_No);
   cst_audit.setString(5,c_model_No);
   cst_audit.setString(6,c_Loca_No);
   cst_audit.setString(7,c_Track_No);
   cst_audit.setString(8,c_Division_No);
   cst_audit.setString(9,c_setup_no);
   cst_audit.setString(10,c_New_Feeder_Code);
   cst_audit.setString(11,c_Old_Feeder_Code);
   cst_audit.registerOutParameter(12,Types.VARCHAR);
   cst_audit.execute();
   result = cst_audit.getString(12);
  }
  finally{
   if(conn!=null){
    try{
     conn.close();
    }
    catch(SQLException e){
     e.printStackTrace();
    }
   }
    
  }
  return result ;
 }
 
 //上料位置调整--验证旧飞达及分区
 public String verifyOldFeder(String c_Loca_Code,String c_Feeder_Code)throws Exception{
  String local = "";
  Connection conn = DataBaseConnection.getConnction();
  try{
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_P1_Track_Modify(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1,c_Loca_Code);
   cst_audit.setString(2,c_Feeder_Code);
   cst_audit.registerOutParameter(3,Types.VARCHAR);
   cst_audit.execute();
   local = cst_audit.getString(3);
   
  }finally{
   if (conn != null){
    try{
     conn.close();
    }
    catch (SQLException e){
     e.printStackTrace();
    }
   }
  }
  return local;
  
 }
 
    //*********************上料位置调整**************************// 
 
 // table备料--验证上料表
 public String getSetup(String settable) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_A1_Get_SETUP(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, settable);
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // table备料--扫描TABLE条码
 public String getTableLocal(String tablecode, String setup_id,
   String linetypeid) throws Exception {
  String local = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_A2_get_table_local(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, tablecode);
   cst_audit.setString(2, setup_id);
   cst_audit.setString(3, linetypeid);
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   local = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return local;
 }

 // table备料--扫描物料条码
 public String getItemlot(String setupno, String taskno, String itembarcode)
   throws Exception {
  String local = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_A3_get_item_Lot(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, setupno);// 上料表
   cst_audit.setString(2, taskno);// 任务令id
   cst_audit.setString(3, itembarcode);// 物料条码
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   local = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return local;
 }

 // table备料--扫描飞达条码
 public String scanFeeder(String feedercode, String linetype,
   String feedersizeid, String c_setup_no, String c_Setup_Position) throws Exception {
  System.out.println("feedercode===" + feedercode);
  System.out.println("linetype===" + linetype);
  System.out.println("feedersizeid===" + feedersizeid);
  String local = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_A4_scan_feeder(?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, feedercode);// 飞达条码
   cst_audit.setString(2, linetype);
   cst_audit.setLong(3, new Long(feedersizeid).longValue());// 物料条码
   cst_audit.setString(4, c_setup_no);
   cst_audit.setString(5, c_Setup_Position);
   cst_audit.registerOutParameter(6, Types.VARCHAR);

   cst_audit.execute();
   local = cst_audit.getString(6);
   System.out.println("local===" + local);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return local;
 }

 // table备料--TABLE备料(备料确认)
 public String prepareAffirm(String userno, String taskno, String setupno,
   String itemcode, String itemlot, String setup_position,
   String setupqty, String feederid, String tableno, String linetype,
   String tablemodel, String tablelocal, String itembcode,
   String ep_flag_t, String ep_flag)
   throws Exception {
  String local = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_A5_prepare_affirm(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, userno);// 用户工卡号
   cst_audit.setString(2, taskno);// 任务令号
   cst_audit.setString(3, setupno);// 上料表
   cst_audit.setString(4, itemcode);// 物料条码
   cst_audit.setString(5, itemlot);// 物料批次
   cst_audit.setString(6, setup_position);// 上料位置
   cst_audit.setString(7, setupqty);// 上料数量
   cst_audit.setString(8, feederid);// 飞达条码
   cst_audit.setString(9, tableno);// table条码
   cst_audit.setString(10, linetype);// 线体类型
   cst_audit.setString(11, tablemodel);// table备料机器
   cst_audit.setString(12, tablelocal);// table备料分区
   cst_audit.setString(13, itembcode);// 物料条码
   cst_audit.setString(14, ep_flag_t);// 任务令环保要求
   cst_audit.setString(15, ep_flag);// 环保物料checkbox
   cst_audit.registerOutParameter(16, Types.VARCHAR);
   cst_audit.execute();
   local = cst_audit.getString(16);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return local;
 }

 // 检查还未备料的位置
 public String checkSupplyFinish(String setupno,String setup_method) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_B1_CHECK_SUPPLY_FINISH(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, setupno);
   cst_audit.setString(2, setup_method);
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // table备料完成确认
 public String setupComplete(String userno, String setupno) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_C1_G5_setup_complete(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, userno);
   cst_audit.setString(2, setupno);
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // table上线--扫描上料表条码、扫描线体条码
 public String tableUpload(String setupno, String lineno)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_rf_D1_TABLE_UPLOAD(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, setupno);// 上料表
   cst_audit.setString(2, lineno);// 线体编号
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // table上线--扫描TABLE条码
 public String tableUpload2(String tableno, String setupno) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_rf_D2_TABLE_UPLOAD(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, tableno);// TABLE条码
   cst_audit.setString(2, setupno);// 上料表条码
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // table上线--扫描分区条码
 public String tableUpload3(String localno, String lineno) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_rf_D3_TABLE_UPLOAD(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, localno);// 分区条码
   cst_audit.setString(2, lineno);// 线体条码
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // table上线--校验
 public String tableUpload4(String User_No,String Setup_No,String table_No, String table_model,
   String table_local, String local_model, String local_local,
   String lineno, String location_id, String table_LOCATIONS_ID)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_rf_D4_TABLE_UPLOAD(?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, User_No);// 用户编号
   cst_audit.setString(2, Setup_No);// 上料表编号
   cst_audit.setString(3, table_No);// table编号
   cst_audit.setString(4, table_model);// 备料设备
   cst_audit.setString(5, table_local);// 备料分区
   cst_audit.setString(6, local_model);// 设备编号
   cst_audit.setString(7, local_local);// 分区序号
   cst_audit.setString(8, lineno);// 线体条码
   cst_audit.setLong(9, new Long(location_id).longValue());//
   cst_audit.setString(10, table_LOCATIONS_ID);
   cst_audit.registerOutParameter(11, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(11);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

//  table备料完成确认
 public String uploadComplete(String userno, String setupno) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_G5_upload_complete(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, userno);
   cst_audit.setString(2, setupno);
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }
 
 // table下线
 public String tableDownload(String tableno,String c_con_flag,String userno) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_e1_table_download(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, tableno);// table编号
   cst_audit.setString(2, c_con_flag);// 是否强制下线
   cst_audit.setString(3, userno) ;   //用户
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // TRAY盘上料--扫描当前生产的线体号
 public String traySetup1(String c_Loca_Code, String trayno)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_rf_F1_CHECK_TRAY_SETUP(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, c_Loca_Code);// 分区条码
   cst_audit.setString(2, trayno);// table编号
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // TRAY盘上料--扫描物料条码
 public String traySetup2(String c_Tray_Item_Code, String c_Item_Bcode,
   String c_Setup_No) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_F2_get_item_Lot_Tray(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, c_Tray_Item_Code);// tray盘所需物料
   cst_audit.setString(2, c_Item_Bcode);// 实际物料条码
   cst_audit.setString(3, c_Setup_No);// 上料表
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // TRAY盘上料--Tray盘上料确认
 public String traySetup3(String c_User_No, String c_Item_Code,
   String c_org_Item, String c_Item_Lot, String c_Line_No,
   String c_Division, String c_Track_No, String c_Loca,
   String c_Model, String c_Setup_No, String c_Line_Type,
   String C_Setup_Quantity, String n_Abandon_Quantity,
   String c_Item_Bcode, String c_Task_No,
   String ep_flag_t, String ep_flag) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PRC_rf_F3_TRAY_SETUPTEST(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, c_User_No);// 用户工卡号
   cst_audit.setString(2, c_Item_Code);// 物料编码
   cst_audit.setString(3, c_org_Item);// 原物料编码
   cst_audit.setString(4, c_Item_Lot);// 物料批次
   cst_audit.setString(5, c_Line_No);// 线体号
   cst_audit.setString(6, c_Division);// 上料部位
   cst_audit.setString(7, c_Track_No);// 上料栈位
   cst_audit.setString(8, c_Loca);// 上料分区
   cst_audit.setString(9, c_Model);// 上料机器
   cst_audit.setString(10, c_Setup_No);// 上料表
   cst_audit.setString(11, c_Line_Type);// 线体类型
   cst_audit.setString(12, C_Setup_Quantity);// 上料数量
   cst_audit.setLong(13, new Long(n_Abandon_Quantity).longValue());// 抛料数量
   cst_audit.setString(14, c_Item_Bcode);// 物料条码
   cst_audit.setString(15, c_Task_No);// 任务令
   cst_audit.setString(16, ep_flag_t);// 任务令环保标识
   cst_audit.setString(17, ep_flag);// 环保checkbox
   cst_audit.registerOutParameter(18, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(18);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 在线备料--扫描线体条码、上料表条码校验
 public String setupOnline1(String userno, String setupno, String lineno)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_G1_setup_online(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, userno);// 用户工卡号
   cst_audit.setString(2, setupno);// 上料表
   cst_audit.setString(3, lineno);// 线体号
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 在线备料--扫描物料条码
 public String setupOnline2(String setupno, String taskno, String itembcode)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_G2_get_item_lot_online(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, setupno);// 上料表
   cst_audit.setString(2, taskno);// 任务令
   cst_audit.setString(3, itembcode);// 物料条码
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 在线备料--扫描飞达条码
 public String setupOnline3(String feedercode, String linetype,
   String lineno, String feedersizeid, String c_setup_no, String c_Setup_Position) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_G3_scan_feeder_online(?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, feedercode);// 上料表
   cst_audit.setString(2, linetype);// 线体类型
   cst_audit.setString(3, lineno);// 物料条码
   cst_audit.setLong(4, new Long(feedersizeid).longValue());// 物料条码
   cst_audit.setString(5, c_setup_no);// 上料表
   cst_audit.setString(6, c_Setup_Position);// 上料位置
   cst_audit.registerOutParameter(7, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(7);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 在线备料--确定
 public String setupOnline4(String userno, String taskno, String setupno,
   String itemcode, String itemlot, String position, String qty,
   String feederid, String linetype, String lineno, String itembcode,
   String ep_flag_t, String ep_flag)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_G4_pre_aff_online(?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, userno);// 上料表
   cst_audit.setString(2, taskno);// 任务令
   cst_audit.setString(3, setupno);// 物料条码
   cst_audit.setString(4, itemcode);// 物料条码
   cst_audit.setString(5, itemlot);// 物料条码
   cst_audit.setString(6, position);// 物料条码
   cst_audit.setString(7, qty);// 任务令
   cst_audit.setString(8, feederid);// 任务令
   cst_audit.setString(9, linetype);// 任务令
   cst_audit.setString(10, lineno);// 任务令
   cst_audit.setString(11, itembcode);// 任务令
   cst_audit.setString(12, ep_flag_t);// 任务令环保标识
   cst_audit.setString(13, ep_flag);// 物料环保checkbox
   cst_audit.registerOutParameter(14, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(14);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 飞达更换--原飞达扫描
 public String feederChange1(String oldFeederno) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_H1_Old_Feeder_scan(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, oldFeederno);// table编号
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 飞达更换--新飞达扫描
 public String feederChange2(String newFeederno, String oldFeederid)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_H2_new_Feeder_scan(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, newFeederno);// 新飞达编号
   cst_audit.setString(2, oldFeederid);// 旧飞达类型
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 飞达更换--新飞达槽位扫描
 public String feederChange3(String divisionindex, String divisioncode,
   String lineno, String model, String loca, String trackno)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_H3_new_Feeder_div_scan(?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, divisionindex);
   cst_audit.setString(2, divisioncode);
   cst_audit.setString(3, lineno);
   cst_audit.setString(4, model);
   cst_audit.setString(5, loca);
   cst_audit.setString(6, trackno);
   cst_audit.registerOutParameter(7, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(7);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 飞达更换--新飞达物料扫描
 public String feederChange4(String itemcode, String newitemcode,
   String divisionindex, String qty,String Task_No) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_H4_new_Feeder_item_scan(?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, itemcode);// 新飞达编号
   cst_audit.setString(2, newitemcode);// 旧飞达类型
   cst_audit.setString(3, divisionindex);// 旧飞达类型
   cst_audit.setString(4, qty);// 旧飞达类型
   cst_audit.setString(5, Task_No);// 任务令
   cst_audit.registerOutParameter(6, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(6);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 飞达更换--确定
 public String feederChange5(String[] param) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_H5_Feeder_replace(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, param[0]);// 新飞达编号
   cst_audit.setString(2, param[1]);// 旧飞达编号
   cst_audit.setString(3, param[2]);// 旧飞达编号
   cst_audit.setString(4, param[3]);// 旧飞达编号
   cst_audit.setString(5, param[4]);// 旧飞达编号
   cst_audit.setString(6, param[5]);// 旧飞达编号
   cst_audit.setString(7, param[6]);// 旧飞达编号
   cst_audit.setString(8, param[7]);// 旧飞达编号
   cst_audit.setString(9, param[8]);// 旧飞达编号
   cst_audit.setString(10, param[9]);// 旧飞达编号
   cst_audit.setString(11, param[10]);// 旧飞达编号
   // cst_audit.setString(12, param[11]);// 旧飞达编号
   // cst_audit.setString(13, param[12]);// 旧飞达编号
   if (!param[11].equals("")) {
    cst_audit.setLong(12, new Long(param[11]).longValue());// 旧飞达编号
   } else {
    cst_audit.setLong(12, new Long(0).longValue());// 旧飞达编号
    // cst_audit.setLong(14,);// 旧飞达编号

   }
   // cst_audit.setString(15, param[14]);// 旧飞达编号
   // cst_audit.setString(16, param[15]);// 旧飞达编号
   if (!param[12].equals((""))) {
    cst_audit.setLong(13, new Long(param[12]).longValue());// 旧飞达编号
   } else {

    cst_audit.setLong(13, new Long(0).longValue());// 旧飞达编号
   }
   // cst_audit.setString(18, param[17]);// 旧飞达编号
   // cst_audit.setString(19, param[18]);// 旧飞达编号
   if (!param[13].equals((""))) {
    cst_audit.setLong(14, new Long(param[13]).longValue());// 旧飞达编号
   } else {

    cst_audit.setLong(14, new Long(0).longValue());// 旧飞达编号
   }
   cst_audit.registerOutParameter(15, Types.VARCHAR);
   // for(int i=0;i<param.length;i++){
   // System.out.println("i=="+param[i]);
   //   
   // }
   cst_audit.execute();
   setup = cst_audit.getString(15);

  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // TABLE接料--扫描飞达条码
 public String feederOnline1(String c_Loca_code, String c_Division_code)
   throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_I1_scan_feeder_online(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, c_Loca_code);// 分区编号
   cst_audit.setString(2, c_Division_code);// 飞达编号
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // TABLE接料--扫描物料条码
 public String feederOnline2(String feederItemCode, String itemBcode,
   String setupNo) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_I2_get_item_online(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, feederItemCode);// 飞达编号
   cst_audit.setString(2, itemBcode);// 飞达编号
   cst_audit.setString(3, setupNo);// 飞达编号
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // TABLE接料--确定
 public String feederOnline3(String userNo, String itemcode, String orgItem,
   String itemLot, String lineNo, String feederId, String division,
   String trackNo, String loca, String model, String setupNo,
   String lineType, String actualQty, String lastqty,
   String itembcode, String taskno,
   String ep_flag_t, String ep_flag) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_I3_Setup_online(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, userNo);// 飞达编号
   cst_audit.setString(2, itemcode);// 飞达编号
   cst_audit.setString(3, orgItem);// 飞达编号
   cst_audit.setString(4, itemLot);// 飞达编号
   cst_audit.setString(5, lineNo);// 飞达编号
   cst_audit.setLong(6, new Long(feederId).longValue());// 飞达编号
   cst_audit.setString(7, division);// 飞达编号
   cst_audit.setString(8, trackNo);// 飞达编号
   cst_audit.setString(9, loca);// 飞达编号
   cst_audit.setString(10, model);// 飞达编号
   cst_audit.setString(11, setupNo);// 飞达编号
   cst_audit.setString(12, lineType);// 飞达编号
   cst_audit.setString(13, actualQty);// 飞达编号
   cst_audit.setLong(14, new Long(lastqty).longValue());// 飞达编号
   cst_audit.setString(15, itembcode);// 飞达编号
   cst_audit.setString(16, taskno);// 任务令号
   cst_audit.setString(17, ep_flag_t);// 任务令环保标识
   cst_audit.setString(18, ep_flag);// 物料环保checkbox
   cst_audit.registerOutParameter(19, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(19);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 分区查料--提取物料信息
 public String checkitem1(String LocaBcode, String userNo) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_K1_check_item(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, LocaBcode);// 分区条码
   cst_audit.setString(2, userNo);// 用户工号
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 分区table查料--物料比对
 public String checkitem2(String Item_bCode, String Setup_no,
   String model_num,String Loca_num,String userNo,
   String item_code,String Track_num,String div_num,String c_line_no,String c_check_id) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_K2_check_item_scan(?,?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, Item_bCode);
   cst_audit.setString(2, Setup_no);
   cst_audit.setString(3, model_num);
   cst_audit.setString(4, Loca_num);
   cst_audit.setString(5, userNo);
   cst_audit.setString(6, item_code);
   cst_audit.setString(7, Track_num);
   cst_audit.setString(8, div_num);
   cst_audit.setString(9, c_line_no);
   cst_audit.setString(10, c_check_id);
   cst_audit.registerOutParameter(11, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(11);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

//  table查料--提取物料信息
 public String checkitem3(String LocaBcode, String userNo, String c_check_type) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_L1_check_item_table(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, LocaBcode);// table条码
   cst_audit.setString(2, userNo);// 用户工号
   cst_audit.setString(3, c_check_type);// 备料组查料0,qc查料1
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 栈位查料--提取分区物料信息
 public String checkitem4(String LocaBcode) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_M1_check_item(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, LocaBcode);// 分区条码
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 栈位查料--校验槽位信息
 public String checkitem5(String LocaBcode,String Division_code) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_M2_check_item(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, LocaBcode);// 分区条码
   cst_audit.setString(2, Division_code);// 槽位条码
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 栈位查料--校验物料信息
 public String checkitem6(String c_Item_bCode,String c_item_code,
    String c_Setup_No,String c_model_num,
    String c_loca_num,String c_Track_num,
    String c_div_num,String c_user_no) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_M3_check_item(?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, c_Item_bCode);// 物料条码
   cst_audit.setString(2, c_item_code);// 物料编码
   cst_audit.setString(3, c_Setup_No);// 上料表
   cst_audit.setString(4, c_model_num);// 机器
   cst_audit.setString(5, c_loca_num);// 分区
   cst_audit.setString(6, c_Track_num);// 栈位
   cst_audit.setString(7, c_div_num);// 槽位
   cst_audit.setString(8, c_user_no);// 用户
   cst_audit.registerOutParameter(9, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(9);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 接料查料--提取分区接料信息
 public String checkitem7(String LocaBcode) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_N1_check_item(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, LocaBcode);// 分区条码
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 接料查料--校验槽位接料信息
 public String checkitem8(String LocaBcode,String Division_code) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_N2_check_item(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, LocaBcode);// 分区条码
   cst_audit.setString(2, Division_code);// 槽位条码
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 接料查料--校验物料信息
 public String checkitem9(String c_Item_bCode,String c_item_code,
    String c_Setup_No,String c_model_num,
    String c_loca_num,String c_Track_num,
    String c_div_num,String c_user_no,String c_line_no) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_N3_check_item(?,?,?,?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, c_Item_bCode);// 物料条码
   cst_audit.setString(2, c_item_code);// 物料编码
   cst_audit.setString(3, c_Setup_No);// 上料表
   cst_audit.setString(4, c_model_num);// 机器
   cst_audit.setString(5, c_loca_num);// 分区
   cst_audit.setString(6, c_Track_num);// 栈位
   cst_audit.setString(7, c_div_num);// 槽位
   cst_audit.setString(8, c_user_no);// 用户
   cst_audit.setString(9, c_line_no);// 用户
   cst_audit.registerOutParameter(10, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(10);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 接料查料--查询待查料信息
 public String checkitem10(String c_line_no) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_N4_check_item(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, c_line_no);// 线体
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 来料入库--上料表选择
 public String selectbillno() throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_rf_L1_select_in(?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.registerOutParameter(1, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(1);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 校验用户
 public String verifyUser(String username, String password) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select s.password from SMT_STUFF_INFO s where s.STUFF_NO='"
     + username + "'";
   rs = st.executeQuery(query);
   String pw = "";
   if (rs != null && rs.next()) {
    pw = rs.getString(1);
    String p = proPass(pw);
    if (!p.equals(password)) {
     results = "密码不正确,请确认!";
    } else {
     results = "true";
    }
   } else {
    results = "用户名不正确,请确认!";
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 权限
 public String queryPurview(String userno) throws Exception {
  String setup = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call Prc_rf_j1_user_login(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, userno);// 用户工号
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   setup = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return setup;
 }

 // 查询版本号
 public String queryVersion() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select s.PARAM_VALUE from sys_params s where s.PARAM_NAME='RF版本'";
   rs = st.executeQuery(query);
   if (rs != null && rs.next()) {
    results = rs.getString(1);
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 查询运行环境
 public String queryRunEnv() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select s.PARAM_VALUE from sys_params s where s.PARAM_NAME='运行环境'";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    // }

   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 解密算法
 private String proPass(String src) throws Exception {
  String result = "";
  int first = new Integer(src.substring(0, 1)).intValue();
  String src_tem = src.substring(1);
  byte[] b = src_tem.getBytes("iso8859-1");
  byte[] temp = b;
  int i = 0;
  for (; i < b.length; i++) {
   temp[i] = new Integer(new Integer(temp[i]).intValue() ^ (first + 2))
     .byteValue();
  }
  result = new String(temp);
  return result;
 }

 // 查询单据编号
 public String queryBillno() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select t.bill_no from smt_inv_task_turns t where t.status=0"
     + " order by t.bill_no desc";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    while (rs.next()) {
     results += "," + rs.getString(1);
    }
    // }

   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 查询单据信息
 public String queryBillnoInfo(String billno) throws Exception {
  String billinfo = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_inv_turn_bill_info(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   billinfo = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return billinfo;
 }

 // 查询PSN信息
 public String queryPSNInfo(String psnCode) throws Exception {
  String psninfo = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_inv_turn_psn_info(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, psnCode);// 单据编号
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   psninfo = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return psninfo;
 }

 // 物料批转
 public String turnInput(String billno, String psnCode, String number,
   String userNo) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call prc_inv_turn_input(?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.setString(2, psnCode);// PSN条码
   if (null != number && !"".equals("number")) {
    cst_audit.setLong(3, new Long(number));
   } else {
    cst_audit.setLong(3, new Long(0));
   }
   cst_audit.setString(4, userNo);// PSN条码
   cst_audit.registerOutParameter(5, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(5);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // // 查询PSN条码信息
 // public String psn_Query(String psnCode) throws Exception {
 // String results = "";
 // Connection conn = DataBaseConnection.getConnction();
 // try {
 // CallableStatement cst_audit = null;
 // String audit = "{call PG_RF.PSN_Qry(?,?)}";
 // cst_audit = conn.prepareCall(audit);
 // cst_audit.setString(1, psnCode);// 单据编号
 // cst_audit.registerOutParameter(2, Types.VARCHAR);
 // cst_audit.execute();
 // results = cst_audit.getString(2);
 // } finally {
 // if (conn != null) {
 // try {
 // conn.close();
 // } catch (SQLException e) {
 // // TODO 自动生成 catch 块
 // e.printStackTrace();
 // }
 // }
 // }
 // return results;
 // }
 // 查询PSN条码信息
 public String psnQuery(String psnCode) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.PSN_Qry(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, psnCode);// 单据编号
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 查询客户
 public String queryClient() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "SELECT S.CUSTOMER_NO,S.CUSTOMER_NAME from SMT_CUSTOMERS s";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1) + "@" + rs.getString(2);
    while (rs.next()) {
     results += "," + rs.getString(1) + "@" + rs.getString(2);
    }
    // }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 查询客户物料编码
 public String queryMCode(String clientNo, String clientBCode)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.GET_C_ITEM_CODE(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, clientNo);// 客户编码
   cst_audit.setString(2, clientBCode);// 客户条码
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 收料采集(打印09条码)
 public String barCodePrint(String clientNo, String clientBCode,
   String clientMCode, String epFlag, String qty, String userNo)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_RF_BARCODE_PRINT(?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, clientNo);// 客户编码
   cst_audit.setString(2, clientBCode);// 客户条码
   cst_audit.setString(3, clientMCode);// 客户条码
   if (null != epFlag && !epFlag.equals("")) {
    cst_audit.setLong(4, new Long(epFlag));// 客户条码
   }
   if (null != qty && !qty.equals("")) {
    cst_audit.setLong(5, new Long(qty));// 客户条码
   } else {
    cst_audit.setLong(5, new Long(0).longValue());// 客户条码
   }
   cst_audit.setString(6, userNo);// 客户条码
   cst_audit.registerOutParameter(7, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(7);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 查询入库单号
 public String queryInBillno() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select t.bill_no from SMT_INV_ITEM_INS t where t.status = 0 and t.BILL_TYPE_ID=1"
     + " order by t.bill_no desc";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    while (rs.next()) {
     results += "," + rs.getString(1);
    }
    // }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 查询入库单信息
 public String queryInBillnoInfo(String billno) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_IN_COME_BILL_INFO(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 客户编码
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 收料入库
 public String inCome(String billno, String itemBarcode, String psnBarcode,
   String pitch, String qty, String userNo) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_IN_COME(?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.setString(2, itemBarcode);// 客户来料条码
   cst_audit.setString(3, psnBarcode);// PSN物料条码
   cst_audit.setString(4, pitch);// 厂家批次
   if (null != qty && !qty.equals("")) {// 数量
    cst_audit.setLong(5, new Long(qty));
   } else {
    cst_audit.setLong(5, new Long(0).longValue());
   }
   cst_audit.setString(6, userNo);// 操作员
   cst_audit.registerOutParameter(7, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(7);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 查询移库单号
 public String queryMoveBillno() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select t.bill_no from SMT_INV_ITEM_MOVES t where t.status = 0 and t.BILL_TYPE_ID=5"
     + " order by t.bill_no desc";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    while (rs.next()) {
     results += "," + rs.getString(1);
    }
    // }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 查询移库单信息
 public String queryMoveBillInfo(String billno) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_MOVE_BILL_INFO(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 客户编码
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 查询移出数量
 public String queryMoveQty(String itemBarcode) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "SELECT M.QUANTITY FROM SMT_INV_ITEM_STOCKS M WHERE M.ITEM_BARCODE='"
     + itemBarcode + "'";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    while (rs.next()) {
     results += "," + rs.getString(1);
    }
    // }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 移库
 public String invMove(String billno, String itemBarcode, String userNo)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_MOVE(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.setString(2, itemBarcode);// PSN物料条码
   cst_audit.setString(3, userNo);// 操作员
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 查询PSN盘点单号
 public String queryInvectoryBill() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "SELECT M.BILL_NO FROM SMT_INV_ITEM_CHECK M WHERE M.STATUS=0 AND M.BILL_TYPE_ID=8"
     + " and M.transaction_id=17" + " order by M.BILL_NO desc";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    while (rs.next()) {
     results += "," + rs.getString(1);
    }
    // }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 查询客户盘点单号
 public String queryCInvectoryBill() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "SELECT M.BILL_NO FROM SMT_INV_ITEM_CHECK M WHERE M.STATUS=0 AND M.BILL_TYPE_ID=8"
     + " and M.transaction_id=21" + " order by M.BILL_NO desc";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    while (rs.next()) {
     results += "," + rs.getString(1);
    }
    // }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 查询PSN盘点单信息
 public String queryPSNBillInfo(String billno) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_CHECK_BILL_INFO(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 客户编码
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // PSN盘点
 public String psnInvectory(String billno, String itemBarcode, String qty,
   String userNo) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_CHECK_PSN(?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.setString(2, itemBarcode);// PSN物料条码
   if (null != qty && !qty.equals("")) {// 数量
    cst_audit.setLong(3, new Long(qty));
   } else {
    cst_audit.setLong(3, new Long(0).longValue());
   }
   cst_audit.setString(4, userNo);// 操作员
   cst_audit.registerOutParameter(5, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(5);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 客户物料盘点
 public String clientInvectory(String billno, String itemBarcode,
   String qty, String userNo) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_CHECK_ITEM(?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.setString(2, itemBarcode);// PSN物料条码
   if (null != qty && !qty.equals("")) {// 数量
    cst_audit.setLong(3, new Long(qty));
   } else {
    cst_audit.setLong(3, new Long(0).longValue());
   }
   cst_audit.setString(4, userNo);// 操作员
   cst_audit.registerOutParameter(5, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(5);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 根据PSN条码查询客户编码
 public String queryClientCode(String psnCode) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select t.c_item_code from smt_inv_item_barcodes t where t.item_barcode='"
     + psnCode + "'";
   rs = st.executeQuery(query);
   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }

  return results;
 }

 // 09条码查询
 public String query09Code(String clientCode, String itemBarcode)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.QRY_09(?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, clientCode);// 客户编码
   cst_audit.setString(2, itemBarcode);// 客户来料条码
   cst_audit.registerOutParameter(3, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(3);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 查询出库单号
 public String queryOutBillno() throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  try {
   st = conn.createStatement();
   String query = "select t.item_out_no from SMT_INV_ITEM_OUTS t where t.status = 0 and t.BILL_TYPE_ID=2"
     + " order by t.item_out_no desc";
   rs = st.executeQuery(query);

   if (rs != null && rs.next()) {
    // while (rs.next()) {
    results = rs.getString(1);
    while (rs.next()) {
     results += "," + rs.getString(1);
    }
    // }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   try {
    conn.close();
   } catch (SQLException e) {
    // TODO 自动生成 catch 块
    e.printStackTrace();
   }
  }
  return results;
 }

 // 查询出库单信息
 public String queryOutBillInfo(String billno) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_OUT_PRODUCT_BILL_INFO(?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 客户编码
   cst_audit.registerOutParameter(2, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(2);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 生产领料
 public String invOutProduct(String billno, String itemBarcode,
   String forceFlag, String userNo) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_INV_OUT_PRODUCT(?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.setString(2, itemBarcode);// PSN物料条码
   cst_audit.setLong(3, new Long(forceFlag));// PSN物料条码
   cst_audit.setString(4, userNo);// 操作员
   cst_audit.registerOutParameter(5, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(5);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 在线分料前校验
 public String onlineSplitBefore(String itemBarcode, String taskno)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  ResultSet rs_detail = null;
  try {
   st = conn.createStatement();
   String query = "select * from smt_dep_task_info t where t.bill_no_pack='"
     + taskno + "'";
   rs = st.executeQuery(query);
   if (rs == null || !rs.next()) {
    results = "分出打包单号不存在!";
    return results;
   }
   CallableStatement cst_audit = null;
   String audit1 = "{?=call PG_RF.CHECK_ONLINE_SPLIT_TASK(?,?)}";
   cst_audit = conn.prepareCall(audit1);
   cst_audit.registerOutParameter(1, Types.INTEGER);
   cst_audit.setString(2, itemBarcode);
   cst_audit.setString(3, taskno);
   cst_audit.execute();
   results = cst_audit.getString(1);
  } finally {
   if (rs != null) {
    rs.close();
   }
   if (st != null) {
    st.close();
   }
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 在线分料
 public String onlineSplit(String itemBarcode, String num, String quantity,
   String taskno, String userno) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  ResultSet rs_detail = null;
  try {
   st = conn.createStatement();
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.p_psn_online_split(?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, itemBarcode);// 原包的PSN物料条码
   cst_audit.setLong(2, new Long(num));// 包数
   cst_audit.setLong(3, new Long(quantity));// 每包的数量
   cst_audit.setString(4, taskno);// 生产订单号
   cst_audit.setString(5, userno);// 创建人
   cst_audit.registerOutParameter(6, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(6);
   
   if (null != results && !"".equals(results)) {
    if (results.substring(0, 3).equals("001")) {
     String detail = "select t.item_barcode, t.quantity/n"
       + "  from smt_inv_item_out_c_details t/n"
       + " where t.item_out_id =" + results.substring(4);
     rs_detail = st.executeQuery(detail);
     if (rs_detail != null && rs_detail.next()) {
      results = "001[" + rs_detail.getString("item_barcode")
        + "  " + rs_detail.getString("quantity");
      while (rs_detail.next()) {
       results += "["
         + rs_detail.getString("item_barcode")
         + "  " + rs_detail.getString("quantity");
      }
     }
    }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   if (st != null) {
    st.close();
   }
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

//  在线分库前校验 gbm 2008-01-25
 public String onlinestockSplitBefore(String itemBarcode)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  ResultSet rs_detail = null;
  try {
   st = conn.createStatement();
   String query = "select * from SMT_INV_ITEM_STOCKS t where t.ITEM_BARCODE='"
     + itemBarcode + "'";
   rs = st.executeQuery(query);
   if (rs == null || !rs.next())
   {
    results = "0";
    //results = "原PSN物料条码不存在!";
    return results;
   }
   else
   {
    String query_num = "select T.QUANTITY from SMT_INV_ITEM_STOCKS t where t.ITEM_BARCODE='"
     + itemBarcode + "'";
    rs_detail = st.executeQuery(query_num);
    if (rs_detail != null && rs_detail.next())
    {
          results = rs_detail.getString("quantity");
          return results;
    }else
    {
     return results = "数量为空";
    }
   }
   
  } finally {
   if (rs != null) {
    rs.close();
   }
   if (st != null) {
    st.close();
   }
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
 // return results;
 }

 
//  在库分料   gbm 2008-01-23
 public String onlineStockSplit(String itemBarcode, String num, String quantity,
   String taskno, String userno) throws Exception {
  String results = "";
     String result_id = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  ResultSet rs_detail = null;
  try {
   st = conn.createStatement();
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_PSN_SPLIT(?,?,?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, itemBarcode);// 原包的PSN物料条码
   cst_audit.setLong(2, new Long(num));// 包数
   cst_audit.setLong(3, new Long(quantity));// 每包的数量
   cst_audit.setString(4, taskno);// 生产订单号
   cst_audit.setString(5, userno);// 创建人
   cst_audit.registerOutParameter(6, Types.VARCHAR);
   cst_audit.registerOutParameter(7, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(6);
   result_id = cst_audit.getString(7);
   if (null != results && !"".equals(results)) {
    if (results.substring(0, 3).equals("001")) {
     String detail = "select t.ITEM_BARCODE, t.QUANTITY/n"
       + "  from SMT_RF_BARCODE_PRINT T/n"
       + " where t.ID_GROUP  =" + result_id;
     rs_detail = st.executeQuery(detail);
     if (rs_detail != null && rs_detail.next()) {
      results = "001[" + rs_detail.getString("item_barcode")
        + "  " + rs_detail.getString("quantity");
      while (rs_detail.next()) {
       results += "["
         + rs_detail.getString("item_barcode")
         + "  " + rs_detail.getString("quantity");
      }
     }
    }
   }
  } finally {
   if (rs != null) {
    rs.close();
   }
   if (st != null) {
    st.close();
   }
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }
 
 // 查询库存数
 public String queryStcokQty(String itemBarcode) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  ResultSet rs_detail = null;
  try {
   st = conn.createStatement();

   CallableStatement cst_audit = null;
   String audit1 = "{?=call PG_RF.GET_STOCK_QTY(?)}";
   cst_audit = conn.prepareCall(audit1);
   cst_audit.registerOutParameter(1, Types.INTEGER);
   cst_audit.setString(2, itemBarcode);
   cst_audit.execute();
   results = cst_audit.getString(1);
  } finally {
   if (rs != null) {
    rs.close();
   }
   if (st != null) {
    st.close();
   }
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 删除PSN条码
 public String delPSN(String ptype, String billno, String itemBarcode,
   String userNo) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_DEL_PSN(?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, ptype);// 单据类型
   cst_audit.setString(2, billno);// 单据编号
   cst_audit.setString(3, itemBarcode);// PSN物料条码
   cst_audit.setString(4, userNo);// 操作员
   cst_audit.registerOutParameter(5, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(5);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 
 // 查询总数
 public String queryTotal(String ptype, String billno, String itemBarcode)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_BILL_ITEM_SUM(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, ptype);// 单据类型
   cst_audit.setString(2, billno);// 单据编号
   cst_audit.setString(3, itemBarcode);// PSN物料条码
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 得到库存(汇总)盘点帐面数
 public String queryItemQty(String citemCode) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  Statement st = null;
  ResultSet rs = null;
  ResultSet rs_detail = null;
  try {
   st = conn.createStatement();

   CallableStatement cst_audit = null;
   String audit1 = "{?=call PG_RF.GET_CHECK_ITEM_QTY(?)}";
   cst_audit = conn.prepareCall(audit1);
   cst_audit.registerOutParameter(1, Types.INTEGER);
   cst_audit.setString(2, citemCode);
   cst_audit.execute();
   results = cst_audit.getString(1);
  } finally {
   if (rs != null) {
    rs.close();
   }
   if (st != null) {
    st.close();
   }
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 更新盘点汇总的实盘数量
 public String updateCheckItem(String billno, String citemCode, String qty,
   String userno) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_update_CHECK_ITEM(?,?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, billno);// 单据编号
   cst_audit.setString(2, citemCode);// 客户编码
   if (null != qty && !"".equals(qty)) {
    cst_audit.setLong(3, new Long(qty));
   } else {
    cst_audit.setLong(3, new Long(0));
   }
   cst_audit.setString(4, userno);// 操作员
   cst_audit.registerOutParameter(5, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(5);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 订单物料理论剩余数
 public String queryInnageQty(String taskno, String completeQty,
   String itemBarcode) throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_TASK_ITEM_INNAGE_QTY(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, taskno);// 任务令号
   if (null != completeQty && !"".equals(completeQty)) {
    cst_audit.setLong(2, new Long(completeQty));
   } else {
    cst_audit.setLong(2, new Long(0));
   }
   cst_audit.setString(3, itemBarcode);// 操作员
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 得到PSN条码的物料批次号
 public String getPsnLotNo(String itemBarcode) throws Exception {
  String results = "";
  System.out.println("con==");
  Connection conn = DataBaseConnection.getConnction();
  System.out.println("con=="+conn);
  Statement st = null;
  ResultSet rs = null;
  ResultSet rs_detail = null;
  try {
   st = conn.createStatement();

   CallableStatement cst_audit = null;
   String audit1 = "{?=call PG_RF.GET_PSN_LOT_NO(?)}";
   cst_audit = conn.prepareCall(audit1);
   cst_audit.registerOutParameter(1, Types.VARCHAR);
   cst_audit.setString(2, itemBarcode);
   cst_audit.execute();
   results = cst_audit.getString(1);
  } finally {
   if (rs != null) {
    rs.close();
   }
   if (st != null) {
    st.close();
   }
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

 // 更新物料批次号
 public String updatePsnLot(String itemBarcode, String lotNo, String userno)
   throws Exception {
  String results = "";
  Connection conn = DataBaseConnection.getConnction();
  try {
   CallableStatement cst_audit = null;
   String audit = "{call PG_RF.SP_UPDATE_PSN_LOT_NO(?,?,?,?)}";
   cst_audit = conn.prepareCall(audit);
   cst_audit.setString(1, itemBarcode);// PSN条码
   cst_audit.setString(2, lotNo);// 批次
   cst_audit.setString(3, userno);// 操作员
   cst_audit.registerOutParameter(4, Types.VARCHAR);
   cst_audit.execute();
   results = cst_audit.getString(4);
  } finally {
   if (conn != null) {
    try {
     conn.close();
    } catch (SQLException e) {
     // TODO 自动生成 catch 块
     e.printStackTrace();
    }
   }
  }
  return results;
 }

}
============================================================

public class RfEntry {
 //机台上料
 /*
  * 功能:机台上料时,对任务令,栈位,槽位,区位等进行解析校验。
     * create by luoyanqing 2009.03.17
  */
 public String Batchsetupinfo(
                                String PI_USER,  // 操作员
                                String PI_LINE_NO,     //线体编号
                                String PI_MACHINE_CODE , //机器编码
                                float PI_TRACK_NO ,  //栈位编码
                                float PI_DIVISION_NUM ,//槽位编号
                                String PI_PSN_09 , //物料PSN或09
                                float  PI_SETUP_QTY //    上料数量
                                )
 {
  String result = "";
  try{
   ExecuteProcedure pro = new ExecuteProcedure();
   result=pro.Batchsetupinfo(PI_USER, PI_LINE_NO,PI_MACHINE_CODE, PI_TRACK_NO,
                        PI_DIVISION_NUM, PI_PSN_09, PI_SETUP_QTY);
  }catch(Exception ex){
   result = ex.getMessage();
  }  
  return result;
 }

//==================================================================================
 //校验PSN,返回数量
 /*
  * 功能:校验PSN,返回数量
  *  create by luoyanqing 2009.03.17
  */
 public String checkpsn(String psnor09) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkpsn(psnor09);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }
//=======================================================================
 //机台接料
 /*
  * 功能:机台接料
  */
 public String receivemeta(
            String PI_USER,  // 操作员
            String PI_LINE_NO,     //线体编号
            String PI_MACHINE_CODE, //机器编码
            float  PI_TRACK_NO ,  //栈位编码
            float  PI_DIVISION_NUM,//槽位编号
            String PI_PSN_09, //物料PSN或09
            float  PI_SETUP_QTY, //    上料数量
            float  PI_WASTE_QTY  //    浪费数量
)
{
String result = "";
try{
ExecuteProcedure pro = new ExecuteProcedure();
result = pro.receivemeta(PI_USER, PI_LINE_NO,PI_MACHINE_CODE,
                   PI_TRACK_NO,PI_DIVISION_NUM,
                         PI_PSN_09,PI_SETUP_QTY,PI_WASTE_QTY);
}catch(Exception ex){
result = ex.getMessage();
}  
return result;
}
//扫机台条码自动带第一个槽位和栈位。
/*
  * 功能:扫机台条码自动带第一个槽位和栈位。
*/
 public String receivediv(
            String PI_LINE_NO,  //线体编号
            String PI_MACHINE_CODE     //线体编号
            //String PI_SETUP_NO
 )
throws Exception{
String results = "";
try{
 ExecuteProcedure pro = new ExecuteProcedure();
 results = pro.receivediv(PI_LINE_NO, PI_MACHINE_CODE);
 }catch(Exception ex){
 results = ex.getMessage();
 }  
 return results;
 }
 
 //对机台上料漏扫的记录进行查询。
 /*
   * 功能:对机台上料漏扫的记录进行查询。
 */
 public String psQuery(String PI_LINE_NO) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.psQuery(PI_LINE_NO);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }
//替代料位置查询
/*
     * 功能:根据原盘条码查找上料位置。
  * create by luoyanqing 2009.04.8
*/
  public String checkbeforepsn(
             String PI_LINE_NO,  //线体编号
             String PI_PSN_09    //psn或09条码
  )
 throws Exception{
   String results = "";
   try {
    ExecuteProcedure pro = new ExecuteProcedure();
    results = pro.checkbeforepsn(PI_LINE_NO,PI_PSN_09);
   } catch (Exception e) {
    results = e.getMessage();
   }
   return results;
  }

//=======================================================================
 //线体切换
 /*
  * 功能:将上料表及相关信息切换到其它线体上
  */
 public String lineChange(String c_setup_no,String c_line_no){
  String result = "";
  try{
   ExecuteProcedure pro = new ExecuteProcedure();
   result = pro.lineChange(c_setup_no,c_line_no);
  }catch(Exception ex){
   result = ex.getMessage();
  }  
  return result;
 } 
 //*********************上料位置调整**************************//
    //上料位置调整--确认
 
 public String trackModify(
          String c_user_no,
          int c_old_feerder_id,
          int n_slot_qty,
          String c_Setup_No,
          String c_Line_No,
          String c_Line_Type,
          String c_model_No,
          String c_loca_No,
          String c_track_No,
          String c_table_1,
          String c_table_2,
          String c_table_3,
          int c_feeder_id_1,int c_feeder_id_2,int c_feeder_id_3,
          String c_model_1,String c_model_2,String c_model_3,
          String c_loca_1,String c_loca_2,String c_loca_3,
          String c_track_1,String c_track_2,String c_track_3,
          String c_div_1,String c_div_2,String c_div_3,
          String c_Item_Code_1,String c_Item_Code_2,String c_Item_Code_3,
          String c_Item_BCode_1,String c_Item_BCode_2,String c_Item_BCode_3,
          String c_Item_lot_1,String c_Item_lot_2,String c_Item_lot_3,
          int n_qty_1,int n_qty_2,int n_qty_3){
  String result = "";
   try{
    ExecuteProcedure pro = new ExecuteProcedure();
    result = pro.trackModify(
          c_user_no,
             c_old_feerder_id,
             n_slot_qty,
             c_Setup_No,
             c_Line_No,
             c_Line_Type,
             c_model_No,
             c_loca_No,
             c_track_No,
             c_table_1,
             c_table_2,
             c_table_3,
             c_feeder_id_1, c_feeder_id_2, c_feeder_id_3,
             c_model_1, c_model_2, c_model_3,
             c_loca_1, c_loca_2, c_loca_3,
             c_track_1, c_track_2, c_track_3,
             c_div_1, c_div_2, c_div_3,
             c_Item_Code_1, c_Item_Code_2, c_Item_Code_3,
             c_Item_BCode_1, c_Item_BCode_2, c_Item_BCode_3,
             c_Item_lot_1, c_Item_lot_2, c_Item_lot_3,
             n_qty_1, n_qty_2, n_qty_3
             );
   }
   catch(Exception e){
    result = e.getMessage();
   }
  return result;
 } 
 
 //上料位置调整--物料条码校验
 public String verifyMater(
        String c_item_Code,
        String c_new_item_BCode,
        String c_Division_index,
        String c_qty,
        String c_Task_No){
  String result = "";
   try{
    ExecuteProcedure pro = new ExecuteProcedure();
    result = pro.verifyMater(c_item_Code,
          c_new_item_BCode,
          c_Division_index,
          c_qty,
          c_Task_No);
   }
   catch(Exception e){
    result = e.getMessage();
   }
  return result;
 }
 
    //上料位置调整--验证新飞达及分区
 public String verifyNewFeder(
   String c_model_No_Old,
   String c_Loca_No_Old,
   String c_Track_No_Old,
   String c_Line_No,
   String c_model_No,
   String c_Loca_No,
   String c_Track_No,
   String c_Division_No,
   String c_setup_no,
   String c_New_Feeder_Code,
   String c_Old_Feeder_Code
   ){
  String result = "";
  try{
   ExecuteProcedure pro = new ExecuteProcedure();
   result = pro.verifyNewFeder(
      c_model_No_Old,
      c_Loca_No_Old,
      c_Track_No_Old,
      c_Line_No,
      c_model_No,
      c_Loca_No,
      c_Track_No,
      c_Division_No,
      c_setup_no,
      c_New_Feeder_Code,
      c_Old_Feeder_Code
     );
  }
  catch(Exception e){
   result = e.getMessage();
  }
  return result;
 }
 
 //上料位置调整--验证旧飞达及分区
 public String verifyOldFeder(String c_Loca_Code,String  c_Feeder_Code){
  String local = "";
  try{
   ExecuteProcedure pro = new ExecuteProcedure();
   local = pro.verifyOldFeder(c_Loca_Code,c_Feeder_Code);
  }catch (Exception e){
   local = e.getMessage();
  }
  return local;
 }
    //*********************上料位置调整**************************//
 // table备料-- 验证上料表
 public String getSetup(String settable) {
  String setup = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   setup = pro.getSetup(settable);
  } catch (Exception e) {
   setup = e.getMessage();
  }
  return setup;
 }

 // table备料--扫描table条码
 public String getTableLocal(String tablecode, String setup_id,
   String linetypeid) {
  String local = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   local = pro.getTableLocal(tablecode, setup_id, linetypeid);
  } catch (Exception e) {
   local = e.getMessage();
  }
  return local;
 }

 // table备料--扫描物料条码
 public String getItemlot(String setupno, String taskno, String itembarcode) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.getItemlot(setupno, taskno, itembarcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // table备料--扫描飞达条码
 public String scanFeeder(String feedercode, String linetype,
   String feedersizeid, String c_setup_no, String c_Setup_Position) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.scanFeeder(feedercode, linetype,
         feedersizeid, c_setup_no, c_Setup_Position);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // table备料--TABLE备料(备料确认)
 public String prepareAffirm(String userno, String taskno, String setupno,
   String itemcode, String itemlot, String setup_position,
   String setupqty, String feederid, String tableno, String linetype,
   String tablemodel, String tablelocal, String itembcode,
   String ep_flag_t, String ep_flag) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.prepareAffirm(userno, taskno, setupno, itemcode,
     itemlot, setup_position, setupqty, feederid, tableno,
     linetype, tablemodel, tablelocal, itembcode,ep_flag_t,ep_flag);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 检查还未备料的位置
 public String checkSupplyFinish(String setupno,String setup_method) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkSupplyFinish(setupno,setup_method);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // table备料完成确认
 public String setupComplete(String userno, String setupno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.setupComplete(userno, setupno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // table上线
 public String tableUpload(String setupno, String lineno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.tableUpload(setupno, lineno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // table上线--扫描上料表条码、扫描线体条码
 public String tableUpload2(String tableno, String setupno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.tableUpload2(tableno, setupno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // table上线--扫描分区条码
 public String tableUpload3(String localno, String lineno) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.tableUpload3(localno, lineno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // table上线--校验
 public String tableUpload4(String User_No,String Setup_No,String table_No, String table_model,
   String table_local, String local_model, String local_local,
   String lineno, String location_id, String table_LOCATIONS_ID) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.tableUpload4(User_No,Setup_No,table_No, table_model, table_local,
     local_model, local_local, lineno, location_id,
     table_LOCATIONS_ID);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  table上线完成确认
 public String uploadComplete(String userno, String setupno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.uploadComplete(userno, setupno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }
 // table下线
 public String tableDownload(String tableno,String c_con_flag,String userno) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.tableDownload(tableno,c_con_flag,userno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // TRAY盘上料--扫描当前上料的分区和tray盘条码
 public String traySetup1(String c_Loca_Code, String trayno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.traySetup1(c_Loca_Code, trayno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;

 }

 // TRAY盘上料--扫描物料条码
 public String traySetup2(String c_Tray_Item_Code, String c_Item_Bcode,
   String c_Setup_No) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro
     .traySetup2(c_Tray_Item_Code, c_Item_Bcode, c_Setup_No);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;

 }

 // TRAY盘上料--Tray盘上料确认
 public String traySetup3(String c_User_No, String c_Item_Code,
   String c_org_Item, String c_Item_Lot, String c_Line_No,
   String c_Division, String c_Track_No, String c_Loca,
   String c_Model, String c_Setup_No, String c_Line_Type,
   String C_Setup_Quantity, String n_Abandon_Quantity,
   String c_Item_Bcode, String c_Task_No,
   String ep_flag_t, String ep_flag) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.traySetup3(c_User_No, c_Item_Code, c_org_Item,
     c_Item_Lot, c_Line_No, c_Division, c_Track_No, c_Loca,
     c_Model, c_Setup_No, c_Line_Type, C_Setup_Quantity,
     n_Abandon_Quantity, c_Item_Bcode, c_Task_No,
     ep_flag_t, ep_flag);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 在线备料--扫描线体条码、上料表条码校验
 public String setupOnline1(String userno, String setupno, String lineno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.setupOnline1(userno, setupno, lineno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 在线备料--扫描物料条码
 public String setupOnline2(String setupno, String taskno, String itembcode) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.setupOnline2(setupno, taskno, itembcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;

 }

 // 在线备料--扫描飞达条码
 public String setupOnline3(String feedercode, String linetype,
   String lineno, String feedersizeid, String c_setup_no, String c_Setup_Position) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.setupOnline3(feedercode, linetype, lineno,
     feedersizeid, c_setup_no, c_Setup_Position);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 在线备料--确定
 public String setupOnline4(String userno, String taskno, String setupno,
   String itemcode, String itemlot, String position, String qty,
   String feederid, String linetype, String lineno, String itembcode,
   String ep_flag_t, String ep_flag) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.setupOnline4(userno, taskno, setupno, itemcode,
     itemlot, position, qty, feederid, linetype, lineno,
     itembcode,ep_flag_t,ep_flag);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 飞达更换--原飞达扫描
 public String feederChange1(String oldFeederno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederChange1(oldFeederno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 飞达更换--新飞达扫描
 public String feederChange2(String newFeederno, String oldFeederid) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederChange2(newFeederno, oldFeederid);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 飞达更换--新飞达槽位扫描
 public String feederChange3(String divisionindex, String divisioncode,
   String lineno, String model, String loca, String trackno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederChange3(divisionindex, divisioncode, lineno,
     model, loca, trackno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;

 }

 // 飞达更换--新飞达物料扫描
 public String feederChange4(String itemcode, String newitemcode,
   String divisionindex, String qty,String Task_No) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederChange4(itemcode, newitemcode, divisionindex,
     qty,Task_No);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 飞达更换--确定
 public String feederChange5(String[] param) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederChange5(param);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;

 }

 // TABLE接料--扫描飞达条码
 public String feederOnline1(String c_Loca_code, String c_Division_code) {

  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederOnline1(c_Loca_code, c_Division_code);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // TABLE接料--扫描物料条码
 public String feederOnline2(String feederItemCode, String itemBcode,
   String setupNo) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederOnline2(feederItemCode, itemBcode, setupNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;

 }

 // TABLE接料--确定
 public String feederOnline3(String userNo, String itemcode, String orgItem,
   String itemLot, String lineNo, String feederId, String division,
   String trackNo, String loca, String model, String setupNo,
   String lineType, String actualQty, String lastqty,
   String itembcode, String taskno,
   String ep_flag_t, String ep_flag) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.feederOnline3(userNo, itemcode, orgItem, itemLot,
     lineNo, feederId, division, trackNo, loca, model, setupNo,
     lineType, actualQty, lastqty, itembcode, taskno,
     ep_flag_t, ep_flag);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 分区查料--提取物料信息
 public String checkitem1(String LocaBcode, String userNo) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem1(LocaBcode, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  table查料--提取物料信息
 public String checkitem3(String LocaBcode, String userNo, String c_check_type) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem3(LocaBcode, userNo, c_check_type);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 分区table查料--物料比对
 public String checkitem2(String Item_bCode, String Setup_no,
   String model_num,String Loca_num,String userNo,
   String item_code,String Track_num,String div_num,String c_line_no,String c_check_id) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem2(Item_bCode, Setup_no, model_num,
     Loca_num,userNo,item_code,Track_num,div_num,c_line_no,c_check_id);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 
//  栈位查料--提取物料信息
 public String checkitem4(String LocaBcode) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem4(LocaBcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  栈位查料--校验槽位信息
 public String checkitem5(String LocaBcode,String Division_code) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem5(LocaBcode,Division_code);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  栈位查料--校验物料信息
 public String checkitem6(String c_Item_bCode,String c_item_code,
    String c_Setup_No,String c_model_num,
    String c_loca_num,String c_Track_num,
    String c_div_num,String c_user_no) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem6(c_Item_bCode,c_item_code,c_Setup_No,
     c_model_num,c_loca_num,c_Track_num,
     c_div_num,c_user_no);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  接料查料--提取分区接料信息
 public String checkitem7(String LocaBcode) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem7(LocaBcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  接料查料--校验槽位接料信息
 public String checkitem8(String LocaBcode,String Division_code) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem8(LocaBcode,Division_code);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  接料查料--校验物料信息
 public String checkitem9(String c_Item_bCode,String c_item_code,
    String c_Setup_No,String c_model_num,
    String c_loca_num,String c_Track_num,
    String c_div_num,String c_user_no,String c_line_no) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem9(c_Item_bCode,c_item_code,c_Setup_No,
     c_model_num,c_loca_num,c_Track_num,
     c_div_num,c_user_no,c_line_no);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

//  接料查料--接料查料--查询待查料信息
 public String checkitem10(String c_line_no) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.checkitem10(c_line_no);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 来料入库--上料表选择
 public String selectbillno() {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.selectbillno();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 校验用户
 public String verifyUser(String username, String password) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.verifyUser(username, password);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 权限
 public String queryPurview(String userno) {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryPurview(userno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询版本号
 public String queryVersion() {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryVersion();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询运行环境
 public String queryRunEnv() {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryRunEnv();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 public String queryVersion1() {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryVersion();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询单据编号
 public String queryBillno() throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryBillno();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询单据信息
 public String queryBillnoInfo(String billno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryBillnoInfo(billno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询PSN信息
 public String queryPSNInfo(String psnCode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryPSNInfo(psnCode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 物料批转
 public String turnInput(String billno, String psnCode, String number,
   String userNo) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.turnInput(billno, psnCode, number, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询PSN条码信息
 public String psnQuery(String psnCode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.psnQuery(psnCode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询客户
 public String queryClient() throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryClient();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询客户物料编码
 public String queryMCode(String clientNo, String clientBCode)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryMCode(clientNo, clientBCode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 收料采集(打印09条码)
 public String barCodePrint(String clientNo, String clientBCode,
   String clientMCode, String epFlag, String qty, String userNo)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.barCodePrint(clientNo, clientBCode, clientMCode,
     epFlag, qty, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询入库单号
 public String queryInBillno() throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryInBillno();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询入库单信息
 public String queryInBillnoInfo(String billno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryInBillnoInfo(billno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 收料入库
 public String inCome(String billno, String itemBarcode, String psnBarcode,
   String pitch, String qty, String userNo) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.inCome(billno, itemBarcode, psnBarcode, pitch, qty,
     userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询移库单号
 public String queryMoveBillno() throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryMoveBillno();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询移库单信息
 public String queryMoveBillInfo(String billno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryMoveBillInfo(billno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询移出数量
 public String queryMoveQty(String itemBarcode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryMoveQty(itemBarcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 移库
 public String invMove(String billno, String itemBarcode, String userNo)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.invMove(billno, itemBarcode, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询PSN盘点单号
 public String queryInvectoryBill() throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryInvectoryBill();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // PSN盘点
 public String psnInvectory(String billno, String itemBarcode, String qty,
   String userNo) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.psnInvectory(billno, itemBarcode, qty, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询PSN盘点单信息
 public String queryPSNBillInfo(String billno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryPSNBillInfo(billno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 客户物料盘点
 public String clientInvectory(String billno, String itemBarcode,
   String qty, String userNo) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.clientInvectory(billno, itemBarcode, qty, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 根据PSN条码查询客户编码
 public String queryClientCode(String psnCode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryClientCode(psnCode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 09条码查询
 public String query09Code(String clientCode, String itemBarcode)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.query09Code(clientCode, itemBarcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询出库单号
 public String queryOutBillno() throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryOutBillno();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询出库单信息
 public String queryOutBillInfo(String billno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryOutBillInfo(billno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 生产领料
 public String invOutProduct(String billno, String itemBarcode,
   String forceFlag, String userNo) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.invOutProduct(billno, itemBarcode, forceFlag, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询客户盘点单号
 public String queryCInvectoryBill() throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryCInvectoryBill();
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 在线分料前校验
 public String onlineSplitBefore(String itemBarcode, String taskno)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.onlineSplitBefore(itemBarcode, taskno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 在线分料
 public String onlineSplit(String itemBarcode, String num, String quantity,
   String taskno, String userno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.onlineSplit(itemBarcode, num, quantity, taskno,
     userno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }
 
 
//  在线分库前校验  gbm 2008-01-25
 public String onlinestockSplitBefore(String itemBarcode)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.onlinestockSplitBefore(itemBarcode);
   
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }
 
//  在库分料 gbm 2008-01-23
 public String onlineStockSplit(String itemBarcode, String num, String quantity,
   String taskno, String userno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.onlineStockSplit(itemBarcode, num, quantity, taskno,
     userno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询库存数
 public String queryStcokQty(String itemBarcode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryStcokQty(itemBarcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 删除PSN条码
 public String delPSN(String ptype, String billno, String itemBarcode,
   String userNo) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.delPSN(ptype, billno, itemBarcode, userNo);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 查询总数
 public String queryTotal(String ptype, String billno, String itemBarcode)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryTotal(ptype, billno, itemBarcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 得到库存(汇总)盘点帐面数
 public String queryItemQty(String citemCode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryItemQty(citemCode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 更新盘点汇总的实盘数量
 public String updateCheckItem(String billno, String citemCode, String qty,
   String userno) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.updateCheckItem(billno, citemCode, qty, userno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 订单物料理论剩余数
 public String queryInnageQty(String taskno, String completeQty,
   String itemBarcode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.queryInnageQty(taskno, completeQty, itemBarcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 得到PSN条码的物料批次号
 public String getPsnLotNo(String itemBarcode) throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.getPsnLotNo(itemBarcode);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 // 更新物料批次号
 public String updatePsnLot(String itemBarcode, String lotNo, String userno)
   throws Exception {
  String results = "";
  try {
   ExecuteProcedure pro = new ExecuteProcedure();
   results = pro.updatePsnLot(itemBarcode, lotNo, userno);
  } catch (Exception e) {
   results = e.getMessage();
  }
  return results;
 }

 public static void main(String[] arg) {
 
  RfEntry rf = new RfEntry();
  
  String test = "";
  try {
   //test=rf.receivemeta("1", "1", "1", 1, 1, "1", 1, 1);
   //test=rf.Batchsetupinfo("1", "1", "1", "1","1", 1, 1, "1", 1);
   test = rf.tableDownload("822369","0","YC1006");// oracle.jdbc.driver.OracleResultSetImpl@77158a
  } catch (Exception e) {   
   // TODO 自动生成 catch 块
   e.printStackTrace();
  }
  System.out.println("test==" + test);
 } 
 
}

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值