Sample Definition Location

Sepasoft MES Module Suite

Sample Definition Location Object

The Sample Definition Location Object holds all of the information defining a location that samples are taken from. A Sample Definition Location may specify the interval to schedule samples and various due time values. 

When using the term Location within the SPC module, it refers to a virtual location where actual samples are taken. For example, if a sample bottle is taken from packaging line 1 and is tested in the lab for color, then the location is packaging line 1. In addition to the lab taking samples from this location, the operator can take samples to test labels.

Note

Be sure not to confuse a production location with the sample definition location object. The sample definition location object defines a production location that samples for a sample definition can be taken from.

Properties

getAutoApprove()

Description

Returns the auto approve setting for this location.

Syntax

getAutoApprove()

  • Parameters

None

  • Returns

If true, samples will be automatically approved when they are recorded. If false, they have to be manually approved.

Code Example

Python
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
print sampleDefLoc.getAutoApprove()
>>> 
True
>>> 

getComingDueMinutes()

Description

Returns the coming due minutes setting for this location. The value represents the number of minutes required before a sample is due until the sample is considered coming due. For automatically scheduled samples, they are created prior to the actual due time by the number of minutes of this setting.

Syntax

getComingDueMinutes()

  • Parameters

None

  • Returns

Double comingDueMinutes - The coming due in minutes for this sample definition location.

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
print sampleDefLoc.getComingDueMinutes()
>>> 
10.0
>>> 

getIntervalDuration()

Description

Returns the number of minutes needed to take a sample for this location.

Syntax

getIntervalDuration()

  • Parameters

None

  • Returns

double duration - Time duration in minutes to take the sample at this specified location.

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
print sampleDefLoc.getIntervalDuration()
>>> 
11.0
>>> 

getIntervalCount()

Description

Returns the interval for automatically scheduling samples for this location. The units are defined by the Interval type defined for this sample definition.

Syntax

getIntervalCount()


  • Parameters

None

  • Returns

double interval

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
print sampleDefLoc.getIntervalCount()
>>> 
20.0
>>> 

getIntervalUUID()

Description

Retrieves Interval UUID. Can be used to retrieve Interval settings residing on the Enterprise object.

Syntax

getIntervalUUID()


  • Parameters

None

  • Returns

Sting UUID

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
intUUID = sampleDefLoc.getIntervalUUID()

entObj = system.mes.loadMESObjectByEquipmentPath('Enterprise')
interval = entObj.getInterval(intUUID)
print interval.getName()
>>> 
Manual
>>> 

getLocationLink()

Description

Returns the production location equipment path that this sample definition is associated with.

Syntax

getLocationLink()

  • Parameters

None

  • Returns

MES Object Link Location - A linking object the production location that this sample definition is associated with.

Code Example

Python
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)

locationLink = sampleDefLoc.getLocationLink()
print locationLink
print locationLink.getMESObject().getEquipmentPath()
print locationLink.getName()
>>> 
(type: Location,  uuid: 1df27b5a-5db6-4c71-a0c3-a05b155a9ef7)
Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1
Inspection Station 1
>>> 

getOverdueMinutes()

Description

Returns the overdue minutes setting for this location. The value represents the number of minutes required before a sample is due until the sample is considered overdue.

Syntax

getOverdueMinutes()


  • Parameters

None

  • Returns

Overdue in minutes for this sample definition location.

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
print sampleDefLoc.getOverdueMinutes()
>>> 
5.0
>>> 

getMESObject()

Description

Returns the sample definition that this location is a child of.

Syntax

getMESObject()

  • Parameters

None

  • Returns

SampleDefinition parent - Sample definition object which is the parent to this location.

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
print sampleDefLoc.getMESObject()
>>> 
SampleDefinition (105f4262-7a09-438b-9b56-c4e33b279e6b, Case Inspection, 1 parents, 0 children, 0 custom properties, 5 complex properties, artifacts not loaded)
>>> 

getTag()

Description

Returns the tag setting for this location.

Syntax

getTag()

  • Parameters

None

  • Returns

The tag for this sample definition location.

Code Example

Python
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
print sampleDefLoc.getTag()
>>> 
R&D
>>> 

isNew()

Description

Returns true if this sample definition is new.

Syntax

isNew()


  • Parameters

None

  • Returns

 True, if this sample definition is new.

setAutoApprove(autoApprove)

Description

Sets the auto approve setting for this location. If true, samples will be automatically approved when they are recorded. If false, they have to be manually approved.

Syntax

setAutoApprove(autoApprove)

  • Parameters

boolean autoApprove - True if the sample should be automatically approved, False otherwise.

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
sampleDefLoc.setAutoApprove(True)
sampleDef.save()

setComingDueMinutes(comingDueMin)

Description

Sets the coming due minutes setting for this location. The value represents the number of minutes required before a sample is due until the sample is considered coming due. For automatically scheduled samples, they are created prior to actual due time by the number of minutes of this setting.

Syntax

setComingDueMinutes(comingDueMin)


  • Parameters

double comingDueMin - The coming due in minutes for this sample definition location.

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
sampleDefLoc.setComingDueMinutes(13.5)
sampleDef.save()

setIntervalCount(interval)

Description

Sets the interval for automatically scheduling samples for this location. The units are defined by the Interval type defined for this sample definition.

Syntax

setIntervalCount(interval)


  • Parameters

double interval

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
sampleDefLoc.setIntervalCount(11.5)
sampleDef.save()

setIntervalDuration(duration)

Description

Sets the number of minutes needed to take a sample for this location.

Syntax

setIntervalDuration(duration)


  • Parameters

double duration - Time duration in minutes to take the sample at this specified location.

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
sampleDefLoc.setIntervalDuration(5.0)
sampleDef.save()

setIntervalUUID(intervalUUID)

Description

Sets the interval type for this sample definition location.  Interval objects are stored on the Enterprise Equipment object.  If the UUID is unknown, loading the Enterprise object and finding the interval by name and using the associated UUID is recommended.

Syntax

setIntervalUUID(intervalUUID)


  • Parameters

String intervalType

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)

entObj = system.mes.loadMESObjectByEquipmentPath('Enterprise')
for interval in entObj.getIntervals():
	if interval.getName() == 'Every Value Change':
		print interval.getPropertyUUID()
		sampleDefLoc.setIntervalUUID(interval.getPropertyUUID())
		sampleDef.save()
		break

setEnabled(enabled)

Description

Sets sample definition location enabled state. If disabled, samples will not be automatically scheduled or appear in sample definition selection lists for the production location.

Settings

Error

All Settings will be lost for the given Sample Definition Location if disabled.  Sample Definition Location settings will need to be reconfigured if this is re-enabled.

Syntax

setEnabled(enabled)


  • Parameters

boolean enabled - True if the sample should be automatically scheduled, False otherwise.

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)
sampleDefLoc.setEnabled(False)
sampleDef.save()

setOverdueMinutes(overdueMinutes)

Description

Sets the overdue minutes setting for this location. The value represents the number of minutes required before a sample is due until the sample is considered overdue.

Syntax

setOverdueMinutes(overdueMinutes)


  • Parameters

double overdueMinutes

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)

sampleDefLoc.setOverdueMinutes(10.4)
sampleDef.save()

setTag(tag)

Description

Sets the tag setting for this location. The tag is used to assign ownership of who is responsible to take samples. For example, set to “Lab" if the lab is responsible or “Operator” if the operator is responsible.

Syntax

setTag(tag)


  • Parameters

String tag - Name of the tag to be set.

  • Returns

Nothing

Code Example

Code
defName = 'Case Inspection'
sampleDef = system.mes.spc.definition.getSampleDefinition(defName)
locationPath ='Enterprise\El Dorado Hills\Packaging Area\Packaging Line 1\Inspection Station 1'
sampleDefLoc = sampleDef.getSampleLocationPropertyByPath(locationPath)

sampleDefLoc.setTag('QA')
sampleDef.save()

Sepasoft MES Module Suite