Example #1
0
bool TankEngine::getRackCount(int pTankName,int pFillOrder )
{
	int rackLayoutID;
	int sectionSize;

	rackCounts.clear();

// Creating a tank filled with blank racks

	rackLayoutID=0;
//	char tankNo[10];

	CitrTankInfoMap ti=getTankInfoExt(pTankName);

	rackLayoutID=ti->second.rackLayoutCID;

	for( Range< LCDbSectionDef > l = LCDbSectionDefs::records(); l.isValid(); ++ l )
	{
		if( l->getTankLayoutCID()== rackLayoutID
			&& l->getFillOrder() == pFillOrder )
//			&& l->getSectionPrefix().Pos(pSectionName))
		{
			sectionSize= l->getLastRack() - l->getFirstRack() +1;
			int offSet= l->getFirstRack();
			for( int i=offSet; i<(sectionSize+offSet);i++)
			{
				int	count=0;
				for(CitrTankSectionRackSlotMap sl=slotsMap.begin();sl!=slotsMap.end();sl++)
				{


					if( pTankName==sl->first.tank &&
						sl->first.fillOrder == l->getFillOrder() &&
						sl->first.rack == i )
					{
						if (!sl->second.empty() )
						{
							count++;
						}
					}

				}

//			rc= i+1;
//			rc=i;
			TSRLevelSummary ls;
			ls.rackCapacity=l->getRackCapacity();
			ls.rackCount=1;
			ls.slotCapacity=l->getRackCapacity();
			ls.slotsUsed=count;
			rackCounts.insert(RackCountMap::value_type(i,ls));

			}
		}
	}
	return true;
}
Example #2
0
void TankEngine::countRack(LQuery  dbase, int tankCID, int rackLayout
							,int& sectionCount, int & rackCount,int& slotCapacity)
{
// Counting the number of Racks in the tank
	rackCount=0;
//	availableRacks=0;
	slotCapacity=0;
	sectionCount=0;

	LCDbRacks r1;


	for( Range< LCDbSectionDef > r = LCDbSectionDefs::records(); r.isValid(); ++ r )
	{
		if( r->getTankLayoutCID() == rackLayout)
		{

			int noOfRacks;
			sectionCount++;
			noOfRacks     = r->getLastRack() - r->getFirstRack() + 1 ;
			rackCount    += noOfRacks;
			slotCapacity += noOfRacks * r->getRackCapacity();

	// c_rack_number
			r1.read(dbase,tankCID,rackLayout);
			for ( Range <LCDbRack > r= r1; r.isValid(); ++r )
			{
			}
		}
	}


}
Example #3
0
int TankEngine::getRackSize(int pTankName, const std::string & pSectionName
								 ,const std::string & pRackName, int & pFillOrder)
{
	int rackLayoutID;

	rackLayoutID=0;

	CitrTankInfoMap ti=getTankInfoExt(pTankName);
	if ( !isTankInfoEnd( ti ))
	{
		rackLayoutID=ti->second.rackLayoutCID;
	}

	int rackNo=toPosIntDef(pRackName,-1);



	for( Range< LCDbSectionDef > l = LCDbSectionDefs::records(); l.isValid(); ++ l )
	{
	 bool t;
	 t=l->getSectionPrefix().find(pSectionName)==std::string::npos;
		if( l->getTankLayoutCID()== rackLayoutID
				&& l->getSectionPrefix().find(pSectionName)!=std::string::npos
				&& rackNo >= l->getFirstRack() && rackNo <=l->getLastRack())
		{
			pFillOrder= l->getFillOrder();
			return l->getRackCapacity();
		}
	}
	return 0;
}
Example #4
0
bool TankEngine::getSectionCount(int pTankCID)
{
		int tankCID;
		int rackLayoutID;
		SectionCount sc;
		TSRLevelSummary ls;

		tankCID=0;
		rackLayoutID=0;

		CitrTankInfoMap ti=getTankInfoExt(pTankCID);
		tankCID=ti->first;
		rackLayoutID=ti->second.rackLayoutCID;

		sectionCounts.clear();
		int count;

		char tankNo[10];

// Creating a tank filled with blank racks
	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
		if( i->getTankLayoutCID()== rackLayoutID )
		{
// Drawing all the rack details for the tank
			count=0;

// Count all the used slots in the current selected sector (indexed by fillOrder )
			for(CitrTankSectionRackSlotMap sl=slotsMap.begin();sl!=slotsMap.end();sl++)
			{

				if( pTankCID==sl->first.tank &&
				sl->first.fillOrder== i->getFillOrder() )
				{
					if (!sl->second.empty() )
					{
						count++;
					}
				}
			}

			sc.tankCID=tankCID;
//			sc.section= i->getSectionPrefix();
			sc.fillOrder= i->getFillOrder();

			ls.section = i->getSectionPrefix();
			ls.rackCapacity= i->getRackCapacity();
			ls.rackCount= i->getLastRack() - i->getFirstRack() +1 ;
			ls.slotCapacity= ls.rackCount * ls.rackCapacity;
			ls.slotsUsed=count;

			sectionCounts.insert(SectionCountMap::value_type(sc,ls));
		}
	}
	return true;
}
Example #5
0
bool TankEngine::setSlot( int pSlot )
{
	if(! dataBuilt ){return false; }
	if( workingTSRSExt.rack == BRUNKNOWN_INT ) { return false; }

	workingTSRSExt.slot	 = BRUNKNOWN_INT;

	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
		if( i->getTankLayoutCID()== sli.rackLayoutID )
		{
			if( pSlot >= 1 && pSlot <= i->getRackCapacity() )
			{
				workingTSRSExt.slot = pSlot;
				return true;
			}
		}
	}
	return false;
}
Example #6
0
//---------------------------------------------------------------------------
//
//---------------------------------------------------------------------------
bool TankEngine::testSlot( const TankSectionRackSlot&  pTsrs )
{
	if(! dataBuilt ){return false; }
	if( pTsrs.rack == BRUNKNOWN_INT ) { return false; }

	int rackLayoutID=	getRackLayoutID( pTsrs.tank );

	if( rackLayoutID == BRUNKNOWN_INT) {return false; }

	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
		if( i->getTankLayoutCID()== rackLayoutID )
		{
			if( pTsrs.slot >= 1 && pTsrs.slot <= i->getRackCapacity() )
			{
				return true;
			}
		}
	}
	return false;
}
Example #7
0
bool TankEngine::CheckConfirmEndOfTank(const TankSectionRackSlot&  pTsrs)
{
	if(! dataBuilt ){return false; }
	if( pTsrs.tank == BRUNKNOWN_INT || pTsrs.fillOrder== BRUNKNOWN_INT ) { return false; }

	int NoSections;
	int rackLayoutID;

// Check to see if it is the last slot in the tank
// find out how many sections are in the tank first of all
	for( itrTankInfoMap ti= tankInfos.begin(); ti != tankInfos.end() ; ti++ )
	{
		if( ti->second.tankExt== pTsrs.tank)
		{
			NoSections= ti->second.sectionCount;
			rackLayoutID = ti->second.rackLayoutCID;
		}
	}

// Is this the last section in the tank
	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
//		if( i->getTankLayoutCID()== rackLayoutID  && pTsrs.section.find( i->getSectionPrefix())!=std::string::npos )
		if( i->getTankLayoutCID()== rackLayoutID  && pTsrs.fillOrder == i->getFillOrder())
		{
			if( i->getFillOrder() == NoSections)
			{
				// Found the section and it is the last.
				// is it the lasst slot in the rack.
				if( pTsrs.rack == i->getLastRack() && pTsrs.slot == i->getRackCapacity() )
				{
					return true;
				}
			}
		}
	}

	return false;
}
Example #8
0
bool TankEngine::setRack( int pRack )
{
	if(! dataBuilt ){return false; }
	if( workingTSRSExt.fillOrder == BRUNKNOWN_INT ) {return false; }

	workingTSRSExt.rack = BRUNKNOWN_INT;
	workingTSRSExt.slot = BRUNKNOWN_INT;

	sli.rackSlots= BRUNKNOWN_INT;

	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
		if( i->getTankLayoutCID()== sli.rackLayoutID )
		{
			if( pRack >= i->getFirstRack() && pRack <= i->getLastRack() )
			{
				workingTSRSExt.rack = pRack;
				sli.rackSlots = i->getRackCapacity();
				return true;
			}
		}
	}
	return false;
}
Example #9
0
bool TankEngine::checkConfirmSlot ( const TankSectionRackSlot&  pTsrs )
{
	if(! dataBuilt ){return false; }
	if( pTsrs.tank == BRUNKNOWN_INT || pTsrs.fillOrder== BRUNKNOWN_INT ) { return false; }

	int NoSections;
	int rackLayoutID;

// Check to see if it is the last slot in the tank
// find out how many sections are in the tank first of all
	for( itrTankInfoMap ti= tankInfos.begin(); ti != tankInfos.end() ; ti++ )
	{
		if( ti->second.tankExt== pTsrs.tank)
		{
			NoSections	 = ti->second.sectionCount;
			rackLayoutID = ti->second.rackLayoutCID;
		}
	}

// Is this the last section in the tank
	if( pTsrs.fillOrder==NoSections )
	{
		for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
		{
			if( i->getTankLayoutCID()== rackLayoutID && pTsrs.fillOrder== i->getFillOrder() )
//		if( i->getRackLayoutCID()== rackLayoutID && pTsrs.section.Pos( i->getSectionPrefix())!=0 )
			{
				// Found the section and it is the last.
				// is it the lasst slot in the rack.
				if( pTsrs.rack == i->getLastRack() && pTsrs.slot == i->getRackCapacity() )
				{
					return true;
				}
			}
		}
	}

	if( rackLayoutID == BRUNKNOWN_INT) {return false; }

//	std::string pSection;
//	pSection=pTsrs.section;

// Search through the tank layout to find a section
	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
		if( i->getTankLayoutCID()== rackLayoutID && pTsrs.fillOrder== i->getFillOrder() )
//		if( i->getRackLayoutCID()== rackLayoutID && pSection.Pos( i->getSectionPrefix())!=0 )
		{
			if(	i->getConfirmRack() == 1 )
			{
// The location has to be re_selected after the last slot of each rack.
				if(  i->getRackCapacity()== pTsrs.slot )
				{
					return true;
				}else
				{
					return false;
				}
			}else
			{
// The location has to be re_selected on the last slot of the last rack in a section.
				if (i->getLastRack() == pTsrs.rack )
				{
					if(i->getRackCapacity()== pTsrs.slot )
					return true;
				}
			}
		}
	}
	return false;

}