tbf/Results/Mappings/WaterMeterMap.cs
Michal Buzik 52bd0d01ce Restore Genesis communication and Q3 calibration from special branches
A – Registration and execution
- Register GenesisCommunication Factory in the component list.
- Separate the Genesis form and sequence from iPerl communication.

B – Communication activities
- Restore initialization, connection, PCB reading, password and login.
- Include grouped login, mode switching and disconnection.
- Support processing up to 10 slots.

C1 – Input calibration factors
- Read three factors from Water meters / Text1–Text3.
- Validate integer values in the range 1–65535.
- Preserve the default of 15625 when all three fields are empty.

D – Q3 calibration
- Connect the Prepare Q3 → measurement → Write Q3 workflow.
- Add channel processing to FlyingStart and FlyingStartMassCollection.
- Reset previous measurement data and validate calculated factors.
- Mark factors as stored only after StoreCalibration succeeds.

E – Results and database
- Store calibration factors separately for each meter and channel.
- Add result entities, mappings and Q3 data.
- Extend DB.cs / EnsureSchema to create and update the schema.
- Preserve compatibility with the existing binary format.

Validation:
- Debug build and 18 tests passed.
- Simulated communication runs follow the same activity sequence.
- The complete Q3 workflow has not yet been verified on hardware.

Known limitation:
- An inherited mismatch in simulated responses and error propagation
  can produce an incorrect OK result; this change does not fix it.
2026-09-09 15:04:49 +02:00

77 lines
2.1 KiB
C#

///
/// Copyright (c) 2015-2021 Sensus Slovensko a.s.
///
using FluentNHibernate.Mapping;
using Results.Entities;
namespace Results.Mappings
{
class WaterMeterMap : ClassMap<WaterMeter>
{
public WaterMeterMap()
{
Id(x => x.Id);
Map(x => x.SerialNr);
Map(x => x.SerialNrAux);
Map(x => x.RadioAddress);
Map(x => x.PurchaseOrder);
Map(x => x.YearOfProduction);
Map(x => x.WMPosition);
Map(x => x.EndState);
Map(x => x.EndStateAux);
Map(x => x.QRise);
Map(x => x.QFall);
Map(x => x.ErrorFlags);
Map(x => x.InfoFlags);
Map(x => x.Passed);
Map(x => x.ResultCode);
Map(x => x.ArchivePath);
Map(x => x.Remark)
.CustomType("StringClob")
.CustomSqlType("varchar(2000)");
#if IPERL
Map(x => x.OrigCalibFactor);
Map(x => x.CalibFactor);
Map(x => x.CalibFactorNominal);
Map(x => x.OrigCalibFactorLNA);
Map(x => x.CalibFactorLNA);
Map(x => x.Q2ErrWOCorrection);
Map(x => x.Q2CorrRL);
Map(x => x.Q2CorrLR);
Map(x => x.Q2CorrFlowRight);
Map(x => x.Diff2Hz8Hz);
Map(x => x.Hz2CorrectionDone);
Map(x => x.Hz2Correction);
Map(x => x.FWVersion);
#endif
#if TURA_SPECIAL
Map(x => x.PaletteNr);
Map(x => x.UmkartonNr);
Map(x => x.ProdTestBench);
Map(x => x.ProdWMPosition);
Map(x => x.ProdUserName);
Map(x => x.ProdPurchaseOrder);
Map(x => x.ProdPassed);
Map(x => x.ProdResultCode);
Map(x => x.ProdQ2CorrRL);
Map(x => x.ProdQ2CorrLR);
#endif
#if ORACLE_DB
Map(x => x.AssignedSerialNr);
Map(x => x.Prefix);
Map(x => x.Suffix);
Map(x => x.CompleteSerialNr);
Map(x => x.OriRadioAddress);
Map(x => x.WMTypeRevision);
Map(x => x.Pruefindex);
Map(x => x.HydrPruefung);
#endif
Map(x => x.Q3Channel);// Genesis meter identification
References(x => x.WaterMeterData);
References(x => x.Batch);
HasMany(x => x.MeterTestRslts)
.Cascade.All();
}
}
}