updateData界面,功能完成
This commit is contained in:
		
							parent
							
								
									01bbf3e70c
								
							
						
					
					
						commit
						4db9712804
					
				
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@ -1,5 +1,5 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
<module name="solarInsertDB-rt" bajaVersion="0" vendor="MJM" vendorVersion="1.0" description="tsmc-solarInsertDB" preferredSymbol="mjmSolar" nre="true" autoload="true" installable="true" buildMillis="1742829288335" buildHost="WIN-VB61HI6M32L" moduleName="solarInsertDB" runtimeProfile="rt">
 | 
					<module name="solarInsertDB-rt" bajaVersion="0" vendor="MJM" vendorVersion="1.0" description="tsmc-solarInsertDB" preferredSymbol="mjmSolar" nre="true" autoload="true" installable="true" buildMillis="1743074649620" buildHost="WIN-VB61HI6M32L" moduleName="solarInsertDB" runtimeProfile="rt">
 | 
				
			||||||
 <dependencies>
 | 
					 <dependencies>
 | 
				
			||||||
  <dependency name="baja" vendor="Tridium" vendorVersion="4.10"/>
 | 
					  <dependency name="baja" vendor="Tridium" vendorVersion="4.10"/>
 | 
				
			||||||
 </dependencies>
 | 
					 </dependencies>
 | 
				
			||||||
 | 
				
			|||||||
@ -23,11 +23,7 @@ import java.util.*;
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                        @NiagaraProperty(name = "DatabaseInformation", type = "BDatabaseInformation", defaultValue = "new BDatabaseInformation()", flags = Flags.SUMMARY),
 | 
					                        @NiagaraProperty(name = "DatabaseInformation", type = "BDatabaseInformation", defaultValue = "new BDatabaseInformation()", flags = Flags.SUMMARY),
 | 
				
			||||||
                        @NiagaraProperty(name = "disable", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
 | 
					                        @NiagaraProperty(name = "disable", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
 | 
				
			||||||
//                        @NiagaraProperty(name = "exception", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
 | 
					                        @NiagaraProperty(name = "showMessage", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY)
 | 
				
			||||||
//                        @NiagaraProperty(name = "working", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
 | 
					 | 
				
			||||||
                        @NiagaraProperty(name = "showMessage", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
 | 
					 | 
				
			||||||
//                        @NiagaraProperty(name = "path", type = "String", defaultValue = "", flags = Flags.SUMMARY),
 | 
					 | 
				
			||||||
//                        @NiagaraProperty(name = "fileName", type = "String", defaultValue = "", flags = Flags.SUMMARY)
 | 
					 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
        actions =
 | 
					        actions =
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
 | 
				
			|||||||
@ -26,11 +26,7 @@ import java.util.*;
 | 
				
			|||||||
                {
 | 
					                {
 | 
				
			||||||
                        @NiagaraProperty(name = "DatabaseInformation", type = "BDatabaseInformation", defaultValue = "new BDatabaseInformation()", flags = Flags.SUMMARY),
 | 
					                        @NiagaraProperty(name = "DatabaseInformation", type = "BDatabaseInformation", defaultValue = "new BDatabaseInformation()", flags = Flags.SUMMARY),
 | 
				
			||||||
                        @NiagaraProperty(name = "disable", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
 | 
					                        @NiagaraProperty(name = "disable", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
 | 
				
			||||||
                        @NiagaraProperty(name = "exception", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
 | 
					                        @NiagaraProperty(name = "showMessage", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY)
 | 
				
			||||||
                        @NiagaraProperty(name = "working", type = "boolean", defaultValue = "false", flags = Flags.SUMMARY),
 | 
					 | 
				
			||||||
                        @NiagaraProperty(name = "showMessage", type = "boolean", defaultValue = "true", flags = Flags.SUMMARY),
 | 
					 | 
				
			||||||
                        @NiagaraProperty(name = "path", type = "String", defaultValue = "", flags = Flags.SUMMARY),
 | 
					 | 
				
			||||||
                        @NiagaraProperty(name = "fileName", type = "String", defaultValue = "", flags = Flags.SUMMARY)
 | 
					 | 
				
			||||||
                },
 | 
					                },
 | 
				
			||||||
        actions =
 | 
					        actions =
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
@ -42,8 +38,8 @@ import java.util.*;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class BUpdateData extends BComponent {
 | 
					public class BUpdateData extends BComponent {
 | 
				
			||||||
/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
 | 
					/*+ ------------ BEGIN BAJA AUTO GENERATED CODE ------------ +*/
 | 
				
			||||||
/*@ $com.mjm.solarInsertDB.BUpdateData(2177564192)1.0$ @*/
 | 
					/*@ $com.mjm.solarInsertDB.BUpdateData(3014327933)1.0$ @*/
 | 
				
			||||||
/* Generated Mon Mar 10 19:48:33 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
 | 
					/* Generated Wed Mar 26 21:11:32 CST 2025 by Slot-o-Matic (c) Tridium, Inc. 2012 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					////////////////////////////////////////////////////////////////
 | 
				
			||||||
// Property "DatabaseInformation"
 | 
					// Property "DatabaseInformation"
 | 
				
			||||||
@ -91,52 +87,6 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
   */
 | 
					   */
 | 
				
			||||||
  public void setDisable(boolean v) { setBoolean(disable, v, null); }
 | 
					  public void setDisable(boolean v) { setBoolean(disable, v, null); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
// Property "exception"
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Slot for the {@code exception} property.
 | 
					 | 
				
			||||||
   * @see #getException
 | 
					 | 
				
			||||||
   * @see #setException
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public static final Property exception = newProperty(Flags.SUMMARY, false, null);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Get the {@code exception} property.
 | 
					 | 
				
			||||||
   * @see #exception
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public boolean getException() { return getBoolean(exception); }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Set the {@code exception} property.
 | 
					 | 
				
			||||||
   * @see #exception
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public void setException(boolean v) { setBoolean(exception, v, null); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
// Property "working"
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Slot for the {@code working} property.
 | 
					 | 
				
			||||||
   * @see #getWorking
 | 
					 | 
				
			||||||
   * @see #setWorking
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public static final Property working = newProperty(Flags.SUMMARY, false, null);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Get the {@code working} property.
 | 
					 | 
				
			||||||
   * @see #working
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public boolean getWorking() { return getBoolean(working); }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Set the {@code working} property.
 | 
					 | 
				
			||||||
   * @see #working
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public void setWorking(boolean v) { setBoolean(working, v, null); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					////////////////////////////////////////////////////////////////
 | 
				
			||||||
// Property "showMessage"
 | 
					// Property "showMessage"
 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					////////////////////////////////////////////////////////////////
 | 
				
			||||||
@ -160,52 +110,6 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
   */
 | 
					   */
 | 
				
			||||||
  public void setShowMessage(boolean v) { setBoolean(showMessage, v, null); }
 | 
					  public void setShowMessage(boolean v) { setBoolean(showMessage, v, null); }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
// Property "path"
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Slot for the {@code path} property.
 | 
					 | 
				
			||||||
   * @see #getPath
 | 
					 | 
				
			||||||
   * @see #setPath
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public static final Property path = newProperty(Flags.SUMMARY, "", null);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Get the {@code path} property.
 | 
					 | 
				
			||||||
   * @see #path
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public String getPath() { return getString(path); }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Set the {@code path} property.
 | 
					 | 
				
			||||||
   * @see #path
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public void setPath(String v) { setString(path, v, null); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
// Property "fileName"
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Slot for the {@code fileName} property.
 | 
					 | 
				
			||||||
   * @see #getFileName
 | 
					 | 
				
			||||||
   * @see #setFileName
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public static final Property fileName = newProperty(Flags.SUMMARY, "", null);
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Get the {@code fileName} property.
 | 
					 | 
				
			||||||
   * @see #fileName
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public String getFileName() { return getString(fileName); }
 | 
					 | 
				
			||||||
  
 | 
					 | 
				
			||||||
  /**
 | 
					 | 
				
			||||||
   * Set the {@code fileName} property.
 | 
					 | 
				
			||||||
   * @see #fileName
 | 
					 | 
				
			||||||
   */
 | 
					 | 
				
			||||||
  public void setFileName(String v) { setString(fileName, v, null); }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					////////////////////////////////////////////////////////////////
 | 
				
			||||||
// Action "update"
 | 
					// Action "update"
 | 
				
			||||||
////////////////////////////////////////////////////////////////
 | 
					////////////////////////////////////////////////////////////////
 | 
				
			||||||
@ -250,6 +154,7 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    BDatabaseInformation databaseInformation = null;
 | 
					    BDatabaseInformation databaseInformation = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void started() {
 | 
					    public void started() {
 | 
				
			||||||
@ -278,13 +183,12 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
            List<String> conditionName = new ArrayList<String>();
 | 
					            List<String> conditionName = new ArrayList<String>();
 | 
				
			||||||
            List<String> conditionValue = new ArrayList<String>();
 | 
					            List<String> conditionValue = new ArrayList<String>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (this.getDisable() || this.getException()) {
 | 
					            if (this.getDisable()) {
 | 
				
			||||||
                if (this.getShowMessage()) {
 | 
					                if (this.getShowMessage()) {
 | 
				
			||||||
                    System.out.println("disable or exception");
 | 
					                    System.out.println("disable or exception");
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                try {
 | 
					                try {
 | 
				
			||||||
                    this.setWorking(true);
 | 
					 | 
				
			||||||
                    Property property[] = this.getDynamicPropertiesArray();
 | 
					                    Property property[] = this.getDynamicPropertiesArray();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    for (int i = 0; i < property.length; i++) {
 | 
					                    for (int i = 0; i < property.length; i++) {
 | 
				
			||||||
@ -320,10 +224,8 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                } catch (Exception e) {
 | 
					                } catch (Exception e) {
 | 
				
			||||||
                    System.out.println(e);
 | 
					                    System.out.println(e);
 | 
				
			||||||
                    this.setException(true);
 | 
					 | 
				
			||||||
                    e.printStackTrace();
 | 
					                    e.printStackTrace();
 | 
				
			||||||
                } finally {
 | 
					                } finally {
 | 
				
			||||||
                    this.setWorking(false);
 | 
					 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
@ -355,7 +257,7 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
        SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
					        SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy-MM-dd");
 | 
				
			||||||
        Date date = new Date();
 | 
					        Date date = new Date();
 | 
				
			||||||
        String strDate = sdFormat.format(date);
 | 
					        String strDate = sdFormat.format(date);
 | 
				
			||||||
        String outputFile = "../../shared/" + this.getPath() + strDate + this.getFileName();
 | 
					        String outputFile = "../../shared/";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // before we open the file check to see if it already exists
 | 
					        // before we open the file check to see if it already exists
 | 
				
			||||||
        boolean alreadyExists = new File(outputFile).exists();
 | 
					        boolean alreadyExists = new File(outputFile).exists();
 | 
				
			||||||
@ -363,15 +265,6 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
            // use FileWriter constructor that specifies open for appending
 | 
					            // use FileWriter constructor that specifies open for appending
 | 
				
			||||||
            if (!alreadyExists) {
 | 
					            if (!alreadyExists) {
 | 
				
			||||||
                deleteFile();
 | 
					                deleteFile();
 | 
				
			||||||
                if (!this.getPath().equals("")) {
 | 
					 | 
				
			||||||
                    File file = new File(outputFile);
 | 
					 | 
				
			||||||
                    file.getParentFile().mkdir();
 | 
					 | 
				
			||||||
                    try {
 | 
					 | 
				
			||||||
                        file.createNewFile();
 | 
					 | 
				
			||||||
                    } catch (IOException e) {
 | 
					 | 
				
			||||||
                        e.printStackTrace();
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, true), ',');
 | 
					            CsvWriter csvOutput = new CsvWriter(new FileWriter(outputFile, true), ',');
 | 
				
			||||||
@ -408,7 +301,7 @@ public class BUpdateData extends BComponent {
 | 
				
			|||||||
            Date sDate = sdf.parse(before90);
 | 
					            Date sDate = sdf.parse(before90);
 | 
				
			||||||
            long beforeTimestamp = sDate.getTime() / 1000;
 | 
					            long beforeTimestamp = sDate.getTime() / 1000;
 | 
				
			||||||
//            System.out.println(beforeTimestamp);
 | 
					//            System.out.println(beforeTimestamp);
 | 
				
			||||||
            String fullpath = "../../shared/" + this.getPath();
 | 
					            String fullpath = "../../shared/";
 | 
				
			||||||
            File a = new File(fullpath);
 | 
					            File a = new File(fullpath);
 | 
				
			||||||
            if (a.isDirectory()) {
 | 
					            if (a.isDirectory()) {
 | 
				
			||||||
                String[] filenames = a.list();
 | 
					                String[] filenames = a.list();
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user