Multiple selection of ERP BOS F7 controls

//First find the multi-select corresponding to the F7 control, and then select this true for the multi-select attribute

//Define an array to hold multiple selection values.
    protected Object[] createDepArr ;  
*/
    @Override
    public void onLoad() throws Exception {
    kDTable1 .checkParsed();
          kDTable1 .removeRows();
    kDDatePicker1 .setDatePattern( "yyyy-MM-dd HH:mm:ss" );
          kDDatePicker2 .setDatePattern( "yyyy-MM-dd HH:mm:ss" );
    Calendar   cal   =   Calendar. getInstance ();
    cal.add(Calendar. DATE ,   -1);
    String yesterday = new SimpleDateFormat( "yyyy-MM-dd " ).format(cal.getTime());
    SimpleDateFormat matter1 = new SimpleDateFormat( "yyyy-MM-dd" );
    SimpleDateFormat sdf = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" );
    kDDatePicker1 .setValue(sdf.parse(yesterday+ " 07:00:00" ));
      //F7 initialization
    CostCenterF7 costCenterF7 = new CostCenterF7();
         costCenterF7.setMultiSelect( true );
    kDBizPromptBox1 .setSelector(costCenterF7); //new CostCenterF7NoPerm()

//click the query button
/**
     * output actionbtn_actionPerformed
     */
    public void actionbtn_actionPerformed (ActionEvent e) throws Exception
    {
      
        /**
         * Click to query
         */
        if (UIRuleUtil. isNull ( kDDatePicker1 .getValue())|| UIRuleUtil. isNull ( kDDatePicker2 .getValue())) {
             MsgBox.showInfo ( " Incorrect time range selection! Both start time and end time must be selected" );
             onLoad();
         } else {
              //Clear the last data
              kDTable1 .checkParsed();
              kDTable1 .removeRows();
              //Get query conditions
              str = kDDatePicker1 .getText().replace( "-" , "" ).replace( ":" , "" ).replace( " " , "" );
            str1 = kDDatePicker2 .getText().replace( "-" , "" ).replace( ":" , "" ).replace( " " , "" );
            //卸货网点
            if ( kDBizPromptBox1 .getText()!= null ) {
//               Unloadingpoint =kDBizPromptBox1.getText();
              //不为空则将F7选择的值赋给数组
              createDepArr = (Object[]) kDBizPromptBox1 .getValue();
             }
            //车牌号
            if ( kDBizPromptBox2 .getText()!= null ) {
              Licenseplate = kDBizPromptBox2 .getText();
             }
            getpd( str , str1 , createDepArr , Licenseplate );
         }
        super .actionbtn_actionPerformed(e);
    }
  
        //卸货网点( 查询sql
          if ( kDBizPromptBox1 .getValue()!= null ) {
    //        sql .append("and T10.fname_l2='"+kDBizPromptBox1.getText()+"'").append("\n");
             sql.append( "and T10.fname_l2 IN ( " ).append( "\n" );
              getSqlAddIn (sql, converStringArr ( createDepArr ));
             sql.append( ") " ).append( "\n" );
         }


  public static String[] converStringArr(Object[] arr) {
            List<String> list = new ArrayList<String>();
            for (Object obj : arr) {
                if (obj instanceof DataBaseInfo) {
                    list.add(((DataBaseInfo) obj).getName().toString());
                } else {
                    list.add(obj.toString());
                }
            }
            return list.toArray( new String[] {});
        }
      public static void getSqlAddIn(StringBuffer sql , String... strArr) {
            sql .append( "'" );
            for (String string : strArr) {
                sql .append(string);
                sql .append( "','" );
            }
            sql .delete( sql .length() - 2, sql .length());
        }





Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325783030&siteId=291194637