Пример #1
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;
}
Пример #2
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;
}
Пример #3
0
//---------------------------------------------------------------------------
// Find the next section in the tank. The tank layout records are ordered by
// tank layout and then by fill ordered. The function finds the section
// and then goes to the next record if it is valid it retrieves the record
// and returns the section prefix.
//---------------------------------------------------------------------------
//bool TankEngine::incSection(const String & pSection,String & pNextSection, int pTankCID )
bool TankEngine::incSection(	int pFillOrder,int pTankCID
									,int & pNextFillOrder,std::string & pNextSection
									,int & pFirstRack )
{
// Find the tank details
	itrTankInfoMap ti= tankInfos.find(pTankCID);
	int rackLayoutID;

	if( ti!= tankInfos.end() )
	{
// retreive the rack layout
		rackLayoutID=ti->second.rackLayoutCID;
	}else
	{
		return false;
	}

// Search through the tank layout to find a section

	short int currFill;
	currFill=BRUNKNOWN_INT;

	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
//		if( i->getRackLayoutCID()== rackLayoutID  && pSection.Pos( i->getSectionPrefix())!=0)
		if( i->getTankLayoutCID()== rackLayoutID  && pFillOrder == i->getFillOrder() )
		{
// Drawing all the rack details for the tank
			currFill =i->getFillOrder();
			currFill++;
			for( Range< LCDbSectionDef > j = LCDbSectionDefs::records(); j.isValid(); ++ j )
		//	for( Range< LCDbTankLayout > j = LCDbTankLayouts::records(); j.isValid(); ++ j )
			{
				if( j->getTankLayoutCID()== rackLayoutID && j->getFillOrder() == currFill )
				{
					pNextSection   = j->getSectionPrefix();
					pNextFillOrder = currFill;
					pFirstRack	   = j->getFirstRack();
					return true;
				}
			}
			return false;
		}
	}
	return false;
}
Пример #4
0
int TankEngine::getFillOrder(  int pRackLayoutCID, const std::string & pSection, int pRack )
{

	for( Range< LCDbSectionDef > i = LCDbSectionDefs::records(); i.isValid(); ++ i )
	{
		if ( i->getTankLayoutCID() == pRackLayoutCID )
		{
			if( pRack  >= i->getFirstRack() && pRack <= i->getLastRack() )
			{
				if (  pSection.compare(i->getSectionPrefix() ) == 0 )
				{
					return i->getFillOrder();
				}
			}
		}

	}
	return BRUNKNOWN_INT;
}