Getting the RepirType
Before creating a UUR report we need to get the repair-type associated to the repair-process. The repair type will let us load the repair categories and codes (FailCodes) for a specific repair process.
in this example we will be using the repair process with process code 500.
Here is how you can get the repair type:
RepairType repairType = api.GetRepairType(api.GetOperationType(500).Id); Creating the UUR Report.
Ideally a UUR report should be linked to the failed step of a failed UUT report. In this example a loaded UUTReport failed_uut will be used as the target for our repair. When no failed UUT exists, consider using a MI (Manual Inspection) to create one, or link the UUR to the PartNumber, Process, Serial and Revision with no report.
Creating the UUR object:
// Option 1 - preferred - Link the repair to a failed UUT
UURReport uur = api.CreateUURReport("RepairTech", repairType, uut);
// Option 2 - link the repair to a process/part
UURReport uur = api.CreateUURReport("RepairOperator", repairType, api.GetOperationType("Final Function Test"), "0001", "ABC123", "1.0");Copying Misc and SubUnit info.
If the repaired unit is a system, or module, and has sub units, therse can be copied from the UUT to the UUR for traceability. This also allows you to assign repair-actions (FailCodes) to the subunits rather than the module/system itself.
// Copy subunits:
foreach (UUTPartInfo subUnit in uut.PartInfo)
{
uur.AddUURPartInfo(subUnit.PartNumber, subUnit.SerialNumber, subUnit.PartRevisionNumber);
}Getting the FailCodes
The failcodes exists in a category > code hierarchy where you will have to get the categories and codes separately using the api-reference.
Get all fail-categories (root level failcodes) then children (child level failcodes):
FailCode[] root_codes = api.GetRootFailCodes(repairType);
FailCode[] child_codes = api.GetChildFailCodes(root_codes[0]);
You can access these, by name, in a more efficient syntax, like this:
FailCode? specificFailCode = api.GetRootFailCodes(repairType).Where(c => c.Description == "Misc").SelectMany(c => api.GetChildFailCodes(c)).FirstOrDefault(fc => fc.Description == "Scrapped");Note that only the child failcode is reported in the repair.
Adding the FailCode to your UUR:
// One-liner to get a specific fail code by category and code description
FailCode? specificFailCode = api.GetRootFailCodes(repairType).Where(c => c.Description == "Misc").SelectMany(c => api.GetChildFailCodes(c)).FirstOrDefault(fc => fc.Description == "Scrapped");
// Add the failure to tghe repaired module.
uur.AddFailure(specificFailCode, "A100", "Comment", uut.GetStepCausedUUTFail().StepOrderNumber);
// Add a sub-repair failcode:
uur.PartInfo[1].AddFailure(specificFailCode, "A100", "Comment", uut.GetStepCausedUUTFail().StepOrderNumber);Note that a failcode can be assigned either to the module itself, or to a child unit by accessing the uur.PartInfo[n].AddFailure()
Now the report is ready to be submitted to the WATS Server:
api.Submit(uur);
Comments
0 comments
Please sign in to leave a comment.