Skip to content
Snippets Groups Projects
Commit 82f24126 authored by Eilert Tunheim's avatar Eilert Tunheim
Browse files

Updated constants and database dynamic coding

parent c729ff26
No related branches found
No related tags found
No related merge requests found
......@@ -28,7 +28,7 @@ public final class Constants {
// Database ID/name
public static final String PROJECT_ID = "sf-drying-optimization";
/*
// Location Valasen(124)
// Project settings
public static final int LOCATION_ID = 124;
......@@ -41,16 +41,19 @@ public final class Constants {
public static final String START_DRYING_NAME = "DryingStarted";
public static final String STOP_DRYING_NAME = "CalculatedStop";
public static final String KILIN_NAME = "KilnName";
public static final int KILIN_ID = 5;
public static int KILIN_ID = 5;
// Winccsensordata
public static final String KWH_NAME = "VariantValue";
public static final String TIMESTAMP_NAME = "Timestamp";
public static final String VALUE_ID_NAME = "ValueID";
public static final int VALUE_ID = 51;
*/
public static final int LIMIT = 1000;
/*
// Location Arjang(174)
// Project settings
public static final int LOCATION_ID = 174;
......@@ -63,13 +66,18 @@ public final class Constants {
public static final String START_DRYING_NAME = "DryingStarted";
public static final String STOP_DRYING_NAME = "DryingCompleted";
public static final String KILIN_NAME = "KilinId";
public static final int KILIN_ID = 16;
public static int KILIN_ID = 17;
// Swappconsensordata
public static final String KWH_NAME = "RealValue";
public static final String TIMESTAMP_NAME = "Timestamp";
public static final String VALUE_ID_NAME = "ValueID";
public static final int VALUE_ID = 19;
public static final int LIMIT = 1000;
*/
......
......@@ -173,6 +173,7 @@ public class DB {
"WHERE " + TIMESTAMP_NAME + " BETWEEN " + '"'+ entry.getKey() + '"' +
" AND " + '"' + entry.getValue() + '"' +
" AND " + VALUE_ID_NAME + " = " + VALUE_ID + " " +
" AND " + KWH_NAME + " <> 0 " +
" ORDER BY " + TIMESTAMP_NAME + " ASC";
......@@ -275,7 +276,10 @@ public class DB {
// Defining extra parameters if required
String extraInputParameter = "";
if(LOCATION_ID == 124){
extraInputParameter = "AND CalculatedStart BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" ";
extraInputParameter += "AND CalculatedStart BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" ";
}
if(LOCATION_ID == 174){
KILIN_ID -= 1;
}
// Sqlstatement for Valåsen(124)
......@@ -287,7 +291,8 @@ public class DB {
"AND "+STOP_DRYING_NAME+" BETWEEN \"1990-01-01 00:00:00\" AND \"" + TODAYS_DATE + "\" " +
extraInputParameter +
"Group by "+ START_DRYING_NAME + " " +
"Order by "+ START_DRYING_NAME + " ASC ";
"Order by "+ START_DRYING_NAME + " ASC " +
"LIMIT " + LIMIT;
System.out.println(sqlStatement);
......
No preview for this file type
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment