Sepasoft MES Module Suite
Sample Object
The sample object holds all of the information associated with one quality sample. Information regarding the configuration, data collected, and additional factors are provided below.
|
These two functions are commonly used in scripts to create new samples: |
Methods
- calcScheduledFinish()
- getApproved()
- getApprovedBy()
- getApprovedDateTime()
- getArea()
- getDefUUID()
- getEnterprise()
- getEntryDateTime()
- getLine()
- getLocation()
- getLocationPath()
- getNote()
- getProductCode()
- getRefNo()
- getSampleDefinition()
- getSampleTakenBy()
- getSampleTakenDateTime()
- getSampleUUID()
- getScheduledFinish()
- getScheduledStart()
- getSequenceDate()
- getShift()
- getSite()
- getTag()
- isModified()
- isNew()
- setApproved(approved)
- setApprovedBy(approvedBy)
- setApprovedDateTime(approvedDateTime)
- setArea(area)
- setEnterprise(enterprise)
- setEntryDateTime(entryDateTime)
- setLine(line)
- setLocation(location)
- setLocationPath(locationPath)
- setNote(note)
- setProductCode(productCode)
- setRefNo(refNo)
- setSampleDefinition(definition)
- setSampleTakenBy(sampleTakenBy)
- setSampleTakenDateTime(sampleTakenDateTime)
- setScheduledFinish(scheduleFinish)
- setScheduledStart(scheduleStart)
- setSequenceDate(sequenceDate)
- setShift(shift)
- setSite(site)
- setTag(tag)
- getAllMeasurements()
- getSampleData(measNo, attrName)
- getSampleDataValue(measNo, attrName)
- getSampleDataValueFormatted(measNo, attrName, locale)
- isDataModified()
- isSampleDataValid()
- sampleDataExists(sampleData)
- setSampleData(measNo, attrName, value)
- addAddlFactor(factorName, factorValue, recordDateTime)
- addAddlFactor(factorName, factorValue, recordDateTime, enableOverwrite)
- getAddlFactor(factorName)
- getAllAddlFactors()
Based on the scheduled start date and time and the duration of time to take this sample, calculates the date and time this sample is scheduled to be complete. The getScheduledFinish() value is updated after calling this function. The duration of time required to take a sample is defined in the sample definition. For automatic samplings, this value does not apply.
calcScheduledFinish()
- Parameters
None
- Returns
Nothing
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)print sample.calcScheduledFinish() |
>>>None>>> |
getApproved()
Returns true if this sample has been approved. Depending on the settings in the sample definition, samples may be automatically or manually approved.
getApproved()
- Parameters
None
- Returns
True, if the sample has been approved.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getApproved() |
>>>True>>> |
getApprovedBy()
Returns the person’s name who approved this sample. For automatically recorded samples, this will be “Auto”.
getApprovedBy()
- Parameters
None
- Returns
String approvedBy - Name of the person who approved this sample.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getApprovedBy() |
>>>sepasoftadmin>>> |
getApprovedDateTime()
Returns the date and time that this sample was approved. For automatically approved samples, this will be the same as the getEntryDateTime() value.
getApprovedDateTime()
- Parameters
None
- Returns
Calendar approvedDateTime - Date and time that this sample was approved.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getApprovedDateTime() |
>>>java.util.GregorianCalendar[time=1521242263000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=2,WEEK_OF_YEAR=11,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,DAY_OF_YEAR=75,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=17,SECOND=43,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]>>> |
getArea()
Returns the production area associated with this sample.
getArea()
- Parameters
None
- Returns
String area - The production model area equipment associated with the sample. More details about the production model.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getArea() |
>>>Packaging>>> |
getDefUUID()
Returns the definition UUID associated with this sample. (See Sample Definition object for more information).
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getDefUUID() |
>>>317c12e9-7324-47a5-9505-c2768e1e48c5>>> |
getEnterprise()
Returns the enterprise associated with this sample.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getEnterprise() |
>>>Nuts Unlimited>>> |
getEntryDateTime()
Returns the date and time that this sample was entered.
getEntryDateTime()
- Parameters
None
- Returns
Calendar entryDateTime - Date and time for which the sample was entered.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getEntryDateTime() |
>>>java.util.GregorianCalendar[time=1521242263000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=2,WEEK_OF_YEAR=11,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,DAY_OF_YEAR=75,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=17,SECOND=43,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]>>> |
getLine()
Returns the production line associated with this sample. This will be blank if the location the sample is taken is in a production area and not on a production line.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getLine() |
>>>Packaging Line 1>>> |
getLocation()
Returns the location associated with this sample.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getLocation() |
>>>Line 1 Quality>>> |
getLocationPath()
Returns the full location path, including enterprise, site, area, line and location, associated with this sample.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getLocationPath() |
>>>Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality>>> |
getNote()
Returns the note associated with this sample. This is the note that may have been entered when the sample was entered. Even though this note can be viewed on the control charts or in analysis, it is not the same as the attribute note entered on the control charts.
1 2 3 | sampleUUID = 'ac4d02e6-2246-46e7-afbe-a8593370b21c'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getNote() |
>>>hello>>> |
getProductCode()
Returns the product code associated with this sample. This is optional and may not apply if tracking quality by product code is not being used for the associated sample definition.
getProductCode()
- Parameters
None
- Returns
String productCode - The product code associated with the sample.
1 2 3 | sampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getProductCode() |
>>>PC009>>> |
getRefNo()
Returns the reference number associated with this sample. This is optional and can be used to track information like batch number, lot number, etc. Additional factors can also be used to track information.
1 2 3 | sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getRefNo() |
>>>4>>> |
getSampleDefinition()
Returns the definition associated with this sample. See Sample Definition object for more information.
getSampleDefinition()
- Parameters
None
- Returns
SampleDefinition definition - Definition associated with the sample.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getSampleDefinition() |
>>>com.sepasoft.mes.spc.common.core.SampleDefinition@169405f>>> |
getSampleTakenBy()
Returns the person’s name who was responsible for taking the sample. By default, this is the person who is logged in when the sample is entered. For automatically recorded samples, this will be “Auto”.
getSampleTakenBy()
- Parameters
None
- Returns
String sampleTakenBy - username of person who took the sample.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getSampleTakenBy() |
>>>sepasoftadmin>>> |
getSampleTakenDateTime()
Returns the date and time that this sample was taken.
getSampleTakenDateTime()
- Parameters
None
- Returns
Calendar sampleTakenDateTime - The date and time that the sample was taken.
1 2 3 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getSampleTakenDateTime() |
>>>java.util.GregorianCalendar[time=1521242263000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=2,WEEK_OF_YEAR=11,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,DAY_OF_YEAR=75,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=17,SECOND=43,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]>>> |
getSampleUUID()
Returns the UUID assigned to this sample. A UUID is a universally unique identifier that, once assigned to a sample, will never change. It is also unique in that no two samples will have the same UUID.
1 2 3 4 5 | locationPath = 'Enterprise\\El Dorado Hills\\Test\\location1'defName = 'ManualSingleMeasurement'#creates a new samplesample = system.mes.spc.sample.getNewByDefName(defName, locationPath)print sample.getSampleUUID() |
>>>d84b7ba3-7c71-4c31-85c9-8fcb84dd67b5>>> |
getScheduledFinish()
Returns the date and time that taking this sample is scheduled to be complete. For automatic samplings, this value does not apply and will be equal to None.
getScheduledFinish()
- Parameters
None
- Returns
Calendar scheduledFinish - The date and time for the schedule to end.
1 2 3 4 5 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'sampleDefName = 'Nut Defects'sample = system.mes.spc.sample.data.getNewByDefName(sampleDefName, locationPath)print sample.getScheduledFinish() |
>>>java.util.GregorianCalendar[time=1521242263000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=2,WEEK_OF_YEAR=11,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,DAY_OF_YEAR=75,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=17,SECOND=43,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]>>> |
getScheduledStart()
Returns the date and time that this sample is scheduled to be taken. For automatic samplings, this value does not apply and will be equal to None.
getScheduledStart()
- Parameters
None
- Returns
Calendar scheduledStart - The date and time for the sample to start.
1 2 3 4 5 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'sampleDefName = 'Nut Defects'sample = system.mes.spc.sample.data.getNewByDefName(sampleDefName, locationPath)print sample.getScheduledStart() |
>>>java.util.GregorianCalendar[time=1521242263000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=2,WEEK_OF_YEAR=11,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,DAY_OF_YEAR=75,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=4,HOUR_OF_DAY=16,MINUTE=17,SECOND=43,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]>>> |
getSequenceDate()
Returns the date and time that the shift the sample was taken during started.
getSequenceDate()
- Parameters
None
- Returns
Calendar sequenceDate - Start date of the current active shift.
1 2 3 4 5 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'sampleDefName = 'Nut Defects'sample = system.mes.spc.sample.data.getNewByDefName(sampleDefName, locationPath)print sample.getSequenceDate() |
>>>java.util.GregorianCalendar[time=1521237600000,areFieldsSet=true,areAllFieldsSet=false,lenient=true,zone=sun.util.calendar.ZoneInfo[id="America/Los_Angeles",offset=-28800000,dstSavings=3600000,useDaylight=true,transitions=185,lastRule=java.util.SimpleTimeZone[id=America/Los_Angeles,offset=-28800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=2,startDay=8,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=3,endMonth=10,endDay=1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]],firstDayOfWeek=1,minimalDaysInFirstWeek=1,ERA=1,YEAR=2018,MONTH=2,WEEK_OF_YEAR=11,WEEK_OF_MONTH=3,DAY_OF_MONTH=16,DAY_OF_YEAR=75,DAY_OF_WEEK=6,DAY_OF_WEEK_IN_MONTH=3,AM_PM=1,HOUR=3,HOUR_OF_DAY=15,MINUTE=0,SECOND=0,MILLISECOND=0,ZONE_OFFSET=-28800000,DST_OFFSET=3600000]>>> |
getShift()
Returns the shift the sample was taken.
1 2 3 4 5 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'sampleDefName = 'Nut Defects'sample = system.mes.spc.sample.data.getNewByDefName(sampleDefName, locationPath)print sample.getShift() |
>>>2>>> |
getSite()
Returns the physical production facility associated with this sample.
1 2 3 | sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getSite() |
>>>Folsom>>> |
getTag()
Returns the optional tag value. This is typically used to assign ownership of which department has the responsibility to take this sample.
1 2 3 | sampleUUID = 'ac4d02e6-2246-46e7-afbe-a8593370b21c'sample = system.mes.spc.sample.getSample(sampleUUID)sample.getTag() |
>>>Weight>>> |
isModified()
Returns true if any properties of this sample have been modified.
isModified()
- Parameters
None
- Returns
True, if this sample have been modified.
1 2 3 4 5 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'sampleDefName = 'Nut Defects'sample = system.mes.spc.sample.data.getNewByDefName(sampleDefName, locationPath)print sample.isModified() |
>>>False>>> |
isNew()
Returns true if this is a newly created sample. When using system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, DefinitionName, locationPath) and a blank string is passed for sampleUUID, a new sample is created. In this case, isNew() will return True.
If a sample UUID is passed, the function loads a previously created sample and isNew() returns False.
isNew()
- Parameters
None
- Returns
True, if this sample is newly created.
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#If no SampleUUID is provided, a new Sample is createdsample = system.mes.spc.sample.data.getCreateSampleByName('', 'SampleDefName', locationPath)sample.isNew() |
>>>True>>> |
setApproved(approved)
Set to true to approve this sample.
setApproved(approved)
- Parameters
boolean approved - True, if the sample is to be approved.
- Returns
Nothing
1 2 3 4 5 6 7 8 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)sample.setApproved(True) #get your current logged in usersample.setApprovedBy('sepasoftadmin')system.mes.spc.sample.update(sample,False) |
setApprovedBy(approvedBy)
Sets the person’s name who approved this sample.
setApprovedBy(approvedBy)
- Parameters
String approvedBy - username of the person who approved this sample.
- Returns
Nothing
1 2 3 4 5 6 7 8 | sampleUUID = 'a4c349f9-b894-4c65-81d6-c64c82cdd258'sample = system.mes.spc.sample.getSample(sampleUUID)sample.setApproved(True) #get your current logged in usersample.setApprovedBy('sepasoftadmin')system.mes.spc.sample.update(sample,False) |
setApprovedDateTime(approvedDateTime)
Sets the date and time that this sample was approved.
setApprovedDateTime(approvedDateTime)
- Parameters
Calendar approvedDateTime - Date and time that this sample was approved.
- Returns
Nothing
1 2 3 4 5 6 7 8 9 10 | from java.util import Calendarcal = Calendar.getInstance()cal.add(Calendar.DAY_OF_MONTH, -30)#You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setApprovedDateTime(cal) |
setArea(area)
Sets the production area associated with this sample.
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setArea('Packaging') |
setEnterprise(enterprise)
Sets the enterprise associated with this sample.
setEnterprise(enterprise)
- Parameters
String enterprise - The enterprise of this sample.
- Returns
Nothing
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setEnterprise('Nuts Unlimited') |
setEntryDateTime(entryDateTime)
Sets the date and time that this sample was entered.
setEntryDateTime(entryDateTime)
- Parameters
DateTime - Date and time for which the sample was entered.
- Returns
Nothing
1 2 3 4 5 6 | #You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3' sample = system.mes.spc.sample.getSample(sampleUUID)now = system.date.now()sample.setEntryDateTime(now)system.mes.spc.sample.update(sample,False) |
setLine(line)
Sets the production line associated with this sample.
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setLine('Packaging Line 1') |
setLocation(location)
Sets the production location associated with this sample.
setLocation(location)
- Parameters
String location - The location associated with the sample.
- Returns
Nothing
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setLocation('Line 1 Quality') |
setLocationPath(locationPath)
Sets the enterprise, site, area, line and location from the locationPath parameter.
setLocationPath(locationPath)
- Parameters
String locationPath - The locationPath of this sample.
- Returns
Nothing
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setLocationPath('Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality') |
setNote(note)
Sets the note associated with this sample.
setNote(note)
- Parameters
String note - Note associated with the sample.
- Returns
Nothing
1 2 3 4 | sampleUUID = 'ac4d02e6-2246-46e7-afbe-a8593370b21c'sample = system.mes.spc.sample.getSample(sampleUUID)sample.setNote('hello')system.mes.spc.sample.update(sample, False) |
setProductCode(productCode)
Sets the product code associated with this sample. This can be filtered in Analysis.
setProductCode(productCode)
- Parameters
String productCode - The product code associated with the sample.
- Returns
Nothing
1 2 3 4 | #You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3' sample = system.mes.spc.sample.getSample(sampleUUID)sample.setProductCode('PC009') |
setRefNo(refNo)
Sets the reference number associated with this sample. This can be used as a filter property in analysis.
setRefNo(refNo)
- Parameters
String refNo - The reference number of this sample.
- Returns
Nothing
1 2 3 4 | sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)sample.setRefNo('1111')system.mes.spc.sample.update(sample,False) |
setSampleDefinition(definition)
Sets the definition associated with this sample. See Sample Definition object for more information.
setSampleDefinition(definition)
- Parameters
SampleDefinition definition - Definition associated with the sample.
- Returns
Nothing
setSampleTakenBy(sampleTakenBy)
Sets the person’s name who was responsible for taking the sample.
setSampleTakenBy(sampleTakenBy)
- Parameters
String sampleTakenBy - Name of person who took the sample.
- Returns
Nothing
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setSampleTakenBy('Auto') |
setSampleTakenDateTime(sampleTakenDateTime)
Sets the date and time that this sample was taken.
setSampleTakenDateTime(sampleTakenDateTime)
- Parameters
Date sampleTakenDateTime - Date and time that the sample was taken.
- Returns
Nothing
1 2 3 4 5 6 | #You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3' sample = system.mes.spc.sample.getSample(sampleUUID)now = system.date.now()sample.setSampleTakenDateTime(now)system.mes.spc.sample.update(sample,False) |
setScheduledFinish(scheduleFinish)
Sets the date and time that this sample is scheduled to be completed.
setScheduledFinish(scheduleFinish)
- Parameters
Calendar scheduleFinish - The date and time for the schedule to end.
- Returns
Nothing
1 2 3 4 5 6 7 8 9 10 | from java.util import Calendarcal = Calendar.getInstance()cal.add(Calendar.DAY_OF_MONTH, -30)#You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setScheduledFinish(cal) |
setScheduledStart(scheduleStart)
Sets the date and time that this sample is scheduled to be taken.
setScheduledStart(scheduleStart)
- Parameters
Calendar scheduleStart - The date and time for the schedule to start.
- Returns
Nothing
1 2 3 4 5 6 7 8 9 10 | from java.util import Calendarcal = Calendar.getInstance()cal.add(Calendar.DAY_OF_MONTH, -30)#You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setScheduledStart(cal) |
setSequenceDate(sequenceDate)
Sets the date and time that the shift the sample was taken during started.
setSequenceDate(sequenceDate)
- Parameters
Calendar sequenceDate - Start date of the current active shift.
- Returns
Nothing
1 2 3 4 5 6 7 8 9 10 | from java.util import Calendarcal = Calendar.getInstance()cal.add(Calendar.DAY_OF_MONTH, -30)#You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setSequenceDate(cal) |
setShift(shift)
Sets the shift the sample was taken.
setShift(shift)
- Parameters
int shift - The shift for which the sample was taken.
- Returns
Nothing
1 2 3 4 5 6 7 8 9 10 | from java.util import Calendarcal = Calendar.getInstance()cal.add(Calendar.DAY_OF_MONTH, -30)#You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setShift(2) |
setSite(site)
Sets the physical production site associated with this sample.
setSite(site)
- Parameters
String site - The site of this sample.
- Returns
Nothing
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.setSite('Folsom') |
setTag(tag)
Sets the tag value. This is typically used to assign ownership of which department has the responsibility to take this sample. Not filterable in analysis.
setTag(tag)
- Parameters
String tag - Tag value that specifies the ownership.
- Returns
Nothing
1 2 3 4 | sampleUUID = 'ac4d02e6-2246-46e7-afbe-a8593370b21c'sample = system.mes.spc.sample.getSample(sampleUUID)sample.setTag('QC Issue')system.mes.spc.sample.update(sample, False) |
Measurement Methods
getAllMeasurements()
Returns the measurements associated with this sample. If a sample has been scheduled but the measurement data has not been recorded, the measurement entries will still exist. In this case, use the sampleDataExists() property to determine if the measurement data has been entered.
getAllMeasurements()
- Parameters
None
- Returns
List - A list of all the measurements associated with this sample.
sampleUUID = '69999f0a-49e2-407b-88b5-e56c8d8128d1'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getAllMeasurements() |
[10.8517196997, 11.292325918, 11.2493760506] |
getSampleData(measNo, attrName)
Gets SampleData item for the specified measurement number and attribute.
getSampleData(measNo, attrName)
- Parameters
int measNo - The measurement number associated with the sample.
String attrName - Name of the attribute to return the maximum value for.
- Returns
SampleData data - SampleData item for the specified measurement number and attribute.
1 2 3 4 | sampleUUID = '69999f0a-49e2-407b-88b5-e56c8d8128d1'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getSampleData(1,'Fill Level')print type(sample.getSampleData(1,'Fill Level')) |
>>>10.8517196997<type 'com.sepasoft.quality.common.core.SampleData'>>>> |
getSampleDataValue(measNo, attrName)
Returns a measurement value as a string for the specified measurement number and attribute name.
getSampleDataValue(measNo, attrName)
- Parameters
int measNo - The measurement number associated with the sample.
String attrName - Name of the attribute to return the measurement value for.
- Returns
String value - Measurement value for the specified sample.
1 2 3 4 | sampleUUID = '69999f0a-49e2-407b-88b5-e56c8d8128d1'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getSampleDataValue(1, 'Fill Level')print type(sample.getSampleDataValue(1, 'Fill Level')) |
>>>10.8517196997<type 'unicode'>>>> |
getSampleDataValueFormatted(measNo, attrName, locale)
Returns a measurement value as a string (with formatting applied) for the specified measurement number and attribute name.
Version Specific
Provided in 3.81.8 SP6 and later.
getSampleDataValueFormatted(measNo, attrName, locale)
- Parameters
- int measNo - The measurement number associated with the sample.
- String attrName - Name of the attribute to return the measurement value for.
- string locale - Optional. Overrides the system's default Locale.
- Returns
String value - Measurement value for the specified sample with formatting applied.
isDataModified()
Returns true if any measurement values have been modified.
isDataModified()
- Parameters
None
- Returns
True, if any of the measurement value was modified.
1 2 3 4 5 6 | #You pass your location pathlocationPath = 'Nuts Unlimited\Folsom\Packaging\Packaging Line 1\Line 1 Quality'#You pass your sampleUUIDsampleUUID = '716c05dd-ae1c-4ca3-bc0b-ea51226afec3'sample = system.mes.spc.sample.data.getCreateSampleByName(sampleUUID, '', locationPath)sample.isDataModified() |
>>>False>>> |
isSampleDataValid()
Returns true if the measurements have been entered and are valid.
isSampleDataValid()
- Parameters
None
- Returns
True, if the measurements have been entered and are valid. To be True, all required attributes are entered, attribute names are not null, and measurement numbers are correct and unique.
1 2 3 | sampleUUID = '69999f0a-49e2-407b-88b5-e56c8d8128d1'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.isSampleDataValid() |
>>>True>>> |
sampleDataExists(sampleData)
Returns true if the given sample data exist and False otherwise.
sampleDataExists(sampleData)
- Parameters
SampleData sampleData - The sample data to be checked.
- Returns Boolean
True, if sample data exists and False otherwise.
sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)sampleData = sample.getSampleData(1,'att1')print sample.sampleDataExists(sampleData) |
>>> True >>>
setSampleData(measNo, attrName, value)
Sets a measurement value as a string for the specified measurement number and attribute name.
setSampleData(measNo, attrName, value)
- Parameters
int measNo - The measurement number associated with the sample. Note that the first measurement number starts at one, not zero.
String attrName - Name of the attribute to set the sample data for.
String value - Measurement value for the specified sample.
- Returns
True if successful, otherwise returns false.
1 2 3 4 | sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.setSampleData(1,'att1','2.25')system.mes.spc.sample.update(sample,True) |
>>>True>>> |
Additional Factor Methods
addAddlFactor(factorName, factorValue, recordDateTime)
Adds an additional factor object to this sample.
addAddlFactor(factorName, factorValue, recordDateTime)
- Parameters
String factorName - Name of the additional factor to be added.
String factorValue - Value of the additional factor to be added.
Date recordDateTime - Date and Time at which the additional factor should be added.
- Returns
Nothing
sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.setSampleData(1,'att1','2.26')sample.addAddlFactor('LotID','123', system.date.now())system.mes.spc.sample.update(sample,True) |
addAddlFactor(factorName, factorValue, recordDateTime, enableOverwrite)
Adds an additional factor object to this sample.
addAddlFactor(factorName, factorValue, recordDateTime, enableOverwrite)
- Parameters
String factorName - Name of the additional factor to be added.
String factorValue - Value of the additional factor to be added.
Date recordDateTime - Date and Time at which the additional factor should be added.
boolean enableOverwrite - Set to True to allow overwriting and False otherwise.
- Returns
Nothing
sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)sample.addAddlFactor('LotID','2224',system.date.now(),True)system.mes.spc.sample.update(sample,False) |
getAddlFactor(factorName)
Gets the additional factor object specified by the factorName parameter and associated with this sample. Use this function to get the SampleAdditionalFactor object that can be used to change the value of the additional factor.
getAddlFactor(factorName)
- Parameters
String factorName - Name of the additional factor to be returned. This reflects the name of the additional factor that is configured in the designer.
- Returns
SampleAdditionalFactor - Additional factor object associated with this sample.
sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getAddlFactor('factor1') |
>>> com.sepasoft.production.spc.sample.QualitySampleAdditionalFactor@61f25e0b >>>
getAllAddlFactors()
Returns the list of additional factor values associated with this sample.
getAllAddlFactors()
- Parameters
None
- Returns
List - A list of additional factor objects associated with this sample.
sampleUUID = 'd353b925-cfa3-48af-b563-6840aaa1a13d'sample = system.mes.spc.sample.getSample(sampleUUID)print sample.getAllAddlFactors()for fact in sample.getAllAddlFactors(): print fact.getName(), fact.getValue() |
>>> [com.sepasoft.production.spc.sample.QualitySampleAdditionalFactor@389b6789, com.sepasoft.production.spc.sample.QualitySampleAdditionalFactor@4a731e7d] factor2 123 factor1 123 >>>
Sepasoft MES Module Suite