示例#1
0
void CDatabaseReader::ReadRouteStationRow(CTruckRouteStation& routeStation,
                                          const sql::ResultSet& rs,
                                          const std::auto_ptr<sql::PreparedStatement>& readContractStationTimeStmt)
{
  boost::shared_ptr<CShipmentStation> shipmentStation(new CShipmentStation);
  ReadCoordinate(shipmentStation->_coord, rs);
  shipmentStation->_kind = ReadShipmentStationKind(rs);
  routeStation._shipmentStation = shipmentStation;

  ReadTimePeriod(routeStation._plannedTimePeriod, rs);

  routeStation._remainingTruckCapacity._weightKg = rs.getUInt("leftKg");
  routeStation._remainingTruckCapacity._liter = getDecimal(rs, "leftM3", 3);  // volume
  routeStation._remainingTruckCapacity._units = rs.getUInt("leftUnits");
  if (!rs.isNull("contractStation_id"))
  {
    routeStation._contractIndex = CRouteStation::KUnloadedContract;

    // reading original time period from contract station
    int contractStationId = rs.getInt("contractStation_id");
    readContractStationTimeStmt->setInt(1, contractStationId);
    std::auto_ptr<sql::ResultSet> contractStationRS(readContractStationTimeStmt->executeQuery());
    ReadTimePeriod(routeStation._shipmentStation->_timePeriod, *contractStationRS);
  }
  else
  {
    routeStation._contractIndex = CRouteStation::KNoContract;
  }
}
示例#2
0
void CDatabaseReader::ReadCargoRow(CCargo& cargo, const sql::ResultSet& rs)
{
  cargo._weightKg = rs.getUInt("weightKg");
  cargo._liter = getDecimal(rs, "volumeM3", 3);   // volume
  cargo._units = rs.getUInt("volumeUnits");       // paletten;
  cargo._cargoType = rs.getString("cargoType");
}
示例#3
0
void CDatabaseReader::ReadContractRow(CContract& aContract, const sql::ResultSet& rs)
{
   aContract._id = rs.getInt("id");
   //  _wasSuggestedBefore;             // some assignemnt for this contract was already suggested by an earliear run
   aContract._sealed = rs.getBoolean("sealed");
   aContract._price = getDecimal(rs, "price", 2); // cents
   aContract._loadAmmount._weightKg = rs.getUInt("entireWeightKg");
   aContract._loadAmmount._liter = getDecimal(rs, "entireVolumeM3", 3);       // volume
   aContract._loadAmmount._units = rs.getUInt("entireVolumeUnits"); // paletten;
}
示例#4
0
void CDatabaseReader::ReadTruckRow(CTruck& aTruck, const sql::ResultSet& rs)
{
   aTruck._id = rs.getInt("id");
   aTruck._capacity._weightKg = rs.getUInt("capacityKg");
   aTruck._capacity._liter = getDecimal(rs, "capacityM3", 3);    // volume
   aTruck._capacity._units = rs.getUInt("capacityUnits");        // paletten;

   aTruck._homeStation._lat = getDecimal(rs, "latHome", 6);
   aTruck._homeStation._long = getDecimal(rs, "longHome", 6);

   aTruck._priceHour = getDecimal(rs, "priceHour", 2);
   aTruck._priceKm = getDecimal(rs, "priceKm", 2);
}