Permalink
Browse files

MashItem temperature and gravity log

Implementation continues... and some fixes. Including a severe fix on
Postgres metada, that was unformated by PgAdmin 3. It's about the time
to use command line tools.
  • Loading branch information...
1 parent e3ef811 commit 2d66001a5b6332ef1c27773156a1ca1169c66234 Joao Henrique Levada committed Oct 11, 2012
@@ -117,6 +117,15 @@ create table MshIt (
alter table MshIt add constraint PK_MshIt
primary key (Id);
+create table MshIt_GravLog (
+ Id bigint not null,
+ MshItId bigint not null,
+ GravLogId bigint not null,
+ ItemPos integer not null);
+
+alter table MshIt_GravLog add constraint PK_MshIt_GravLog
+ primary key (Id);
+
create table MshIt_MshIngds (
Id bigint not null,
MshItId bigint not null,
@@ -126,6 +135,15 @@ create table MshIt_MshIngds (
alter table MshIt_MshIngds add constraint PK_MshIt_MshIngds
primary key (Id);
+create table MshIt_TempLog (
+ Id bigint not null,
+ MshItId bigint not null,
+ TempLogId bigint not null,
+ ItemPos integer not null);
+
+alter table MshIt_TempLog add constraint PK_MshIt_TempLog
+ primary key (Id);
+
create table PerContLab (
Id bigint not null,
ClassId bigint not null,
@@ -320,6 +338,28 @@ create table TMash_MashItems (
alter table TMash_MashItems add constraint PK_TMash_MashItems
primary key (Id);
+create table TMashItemGravity (
+ Id bigint not null,
+ ClassId bigint not null,
+ UpdateCount integer not null,
+ MeasuredAt timestamp,
+ InputType smallint,
+ SpecificGravity double precision,
+ Brix double precision);
+
+alter table TMashItemGravity add constraint PK_TMashItemGravity
+ primary key (Id);
+
+create table TMashItemTemperature (
+ Id bigint not null,
+ ClassId bigint not null,
+ UpdateCount integer not null,
+ MeasuredAt timestamp,
+ Temperature double precision);
+
+alter table TMashItemTemperature add constraint PK_TMashItemTemperature
+ primary key (Id);
+
create table TNeighborhood (
Id bigint not null,
ClassId bigint not null,
@@ -525,6 +565,18 @@ alter table MshIt add constraint FK_MshIt_Recipe
on delete no action
on update cascade;
+alter table MshIt_GravLog add constraint FK_MshIt_GravLog_MshItId
+ foreign key (MshItId)
+ references MshIt (Id)
+ on delete no action
+ on update cascade;
+
+alter table MshIt_GravLog add constraint FK_MshIt_GravLog_GravLogId
+ foreign key (GravLogId)
+ references TMashItemGravity (Id)
+ on delete no action
+ on update cascade;
+
alter table MshIt_MshIngds add constraint FK_MshIt_MshIngds_MshItId
foreign key (MshItId)
references MshIt (Id)
@@ -537,6 +589,18 @@ alter table MshIt_MshIngds add constraint FK_MshIt_MshIngds_MshIngdsId
on delete no action
on update cascade;
+alter table MshIt_TempLog add constraint FK_MshIt_TempLog_MshItId
+ foreign key (MshItId)
+ references MshIt (Id)
+ on delete no action
+ on update cascade;
+
+alter table MshIt_TempLog add constraint FK_MshIt_TempLog_TempLogId
+ foreign key (TempLogId)
+ references TMashItemTemperature (Id)
+ on delete no action
+ on update cascade;
+
alter table PerContLab add constraint FK_PerContLab_ClassId
foreign key (ClassId)
references ModelClasses (Id)
@@ -765,6 +829,18 @@ alter table TMash_MashItems add constraint FK_TMash_MashItems_MashItemsId
on delete no action
on update cascade;
+alter table TMashItemGravity add constraint FK_TMashItemGravity_ClassId
+ foreign key (ClassId)
+ references ModelClasses (Id)
+ on delete no action
+ on update cascade;
+
+alter table TMashItemTemperature add constraint FK_TMashItemTemperature_ClassId
+ foreign key (ClassId)
+ references ModelClasses (Id)
+ on delete no action
+ on update cascade;
+
alter table TNeighborhood add constraint FK_TNeighborhood_ClassId
foreign key (ClassId)
references ModelClasses (Id)
@@ -72,6 +72,8 @@ TMashItem = class(TCustomObject)
_Volume: TPressDouble;
_OriginalGravity: TPressDouble;
_MashIngredients: TMashIngredientItemParts;
+ _TemperatureLog: TPressParts;
+ _GravityLog: TPressParts;
private
function GetOriginalGravity: Double;
function GetVolume: Double;
@@ -255,6 +257,8 @@ class function TMashItem.InternalMetadataStr: string;
'Volume: Double;' +
'OriginalGravity: Double;' +
'MashIngredients: TMashIngredientItemParts ShortName="MshIngds";' +
+ 'TemperatureLog: Parts(TMashItemTemperature) ShortName="TempLog";' +
+ 'GravityLog: Parts(TMashItemGravity) ShortName="GravLog";' +
')';
end;
@@ -28,7 +28,7 @@ TMashItemTemperature = class(TCustomObject)
TMashItemGravity = class(TCustomObject)
_MeasuredAt: TPressDateTime;
_InputType: TPressEnum;
- _SpecificGravty: TPressDouble;
+ _SpecificGravity: TPressDouble;
_Brix: TPressDouble;
protected
class function InternalMetadataStr: string; override;
@@ -75,6 +75,10 @@ procedure TMashItemEditPresenter.InitPresenter;
var
VIngredientsPresenter: TPressMVPItemsPresenter;
VRecipePresenter: TPressMVPPresenter;
+ VTemperatureLogPresenter: TPressMVPItemsPresenter;
+ VGravityLogPresenter: TPressMVPItemsPresenter;
+ VTemperaturePresenter: TPressMVPFormPresenter;
+ VGravityPresenter: TPressMVPFormPresenter;
begin
inherited InitPresenter;
VRecipePresenter := CreateSubPresenter('Recipe', 'RecipeComboBox',
@@ -90,6 +94,31 @@ procedure TMashItemEditPresenter.InitPresenter;
VIngredientsPresenter.BindCommand(TPressMVPAddItemsCommand, 'AddMashIngredientSpeedButton');
VIngredientsPresenter.BindCommand(TPressMVPEditItemCommand, 'EditMashIngredientSpeedButton');
VIngredientsPresenter.BindCommand(TPressMVPRemoveItemsCommand, 'RemoveMashIngredientSpeedButton');
+
+ VTemperatureLogPresenter := CreateSubPresenter('TemperatureLog', 'TemperatureLogStringGrid',
+ 'MeasuredAt(198, "Momento da aferição");' +
+ 'Temperature(198, "Temperatura")') as TPressMVPItemsPresenter;
+ VTemperatureLogPresenter.BindCommand(TPressMVPAddItemsCommand, 'AddTemperatureLogSpeedButton');
+ VTemperatureLogPresenter.BindCommand(TPressMVPEditItemCommand, 'EditTemperatureLogSpeedButton');
+ VTemperatureLogPresenter.BindCommand(TPressMVPRemoveItemsCommand, 'RemoveTemperatureLogSpeedButton');
+
+ VTemperaturePresenter := CreateDetailPresenter(VTemperatureLogPresenter);
+ VTemperaturePresenter.CreateSubPresenter('MeasuredAt', 'TemperatureMeasuredAtEdit');
+ VTemperaturePresenter.CreateSubPresenter('Temperature', 'TemperatureEdit');
+
+ VGravityLogPresenter := CreateSubPresenter('GravityLog', 'GravityLogStringGrid',
+ 'MeasuredAt(198, "Momento da aferição");' +
+ 'SpecificGravity(198, "Densidade específica");' +
+ 'Brix(99, "Brix")') as TPressMVPItemsPresenter;
+ VGravityLogPresenter.BindCommand(TPressMVPAddItemsCommand, 'AddGravityLogSpeedButton');
+ VGravityLogPresenter.BindCommand(TPressMVPEditItemCommand, 'EditGravityLogSpeedButton');
+ VGravityLogPresenter.BindCommand(TPressMVPRemoveItemsCommand, 'RemoveGravityLogSpeedButton');
+
+ //VGravityPresenter := CreateDetailPresenter(VGravityLogPresenter);
+ //VGravityPresenter.CreateSubPresenter('MeasuredAt', 'GravityMeasuredAtEdit');
+ //VGravityPresenter.CreateSubPresenter('InputType', 'GravityInputTypeComboBox');
+ //VGravityPresenter.CreateSubPresenter('SpecificGravity', 'GravitySpecificGravityEdit');
+ //VGravityPresenter.CreateSubPresenter('Brix', 'GravityBrixEdit');
end;
{ TMashQueryPresenter }
Oops, something went wrong.

0 comments on commit 2d66001

Please sign in to comment.