Beispiel #1
0
        private void ProcessOutcome(StationOutcome outcome)
        {
            // TODO: Decouple this method from the form
            // Use a state pattern

            // If the item is on hold, but allows station data
            // then update the outcome, but no do not perform routing.
            if (m_item.Hold != null && m_item.Hold.AllowStationData)
            {
                m_process.StationOutcome = outcome;
                return;
            }

            if (!IsTransitionValid())
            {
                outcomeSelList.EditValue = null;
                return;
            }

            StationOutcomeTransition transition = GetTransition(outcome.Label);

            if (transition.EndProcessRoute)
            {
                SetupEndProcess(outcome);
            }
            else
            {
                SetupNextStation(outcome);
            }
        }
Beispiel #2
0
        private void SetupNextStation(StationOutcome outcome)
        {
            if (m_routeStation.NextStationForOutcome(outcome.Label) == null)
            {
                MessageBox.Show(
                    "There is not a station transition defined for this outcome",
                    Application.ProductName, MessageBoxButtons.OK,
                    MessageBoxIcon.Warning);
                return;
            }

            m_process.StationOutcome = outcome;
            m_process.NextStation    =
                m_routeStation.NextStationForOutcome(outcome.Label);
            nextStationText.Text = m_process.NextStationName;
        }
Beispiel #3
0
        public void process_validator_fails_when_there_are_invalid_steps()
        {
            PartAttributesHeader header =
                Xpo.CreateXPObject <PartAttributesHeader>();

            PartAttributeValues values =
                Xpo.CreateXPObject <PartAttributeValues>();

            header.Attr1 = "Firmware";
            header.Attr2 = "ASR";

            values.Header = header;
            values.Attr1  = "E36X";
            values.Attr2  = "A03";

            // Create step1 with Firmware validation
            RouteStationStep step1 = Xpo.CreateXPObject <RouteStationStep>();

            step1.DisplayPrompt  = "Firmware";
            step1.ValidationType = StepResultValidationType.Firmware;

            // Create step2 with MSR validation
            RouteStationStep step2 = Xpo.CreateXPObject <RouteStationStep>();

            step2.DisplayPrompt  = "Current Revision";
            step2.ValidationType = StepResultValidationType.MinimumShippableRevision;

            // Create step3 with OpenText validation
            RouteStationStep step3 = Xpo.CreateXPObject <RouteStationStep>();

            step3.DisplayPrompt  = "Step3";
            step3.ValidationType = StepResultValidationType.OpenText;

            // Create a test part with dummy attributes
            Part part = Xpo.CreateXPObject <Part>();

            // Set the parts attributes to the fake attributes we created.
            part.Attributes = values;

            // Create Firmware step result
            RouteStationResult result1 =
                Xpo.CreateXPObject <RouteStationResult>();

            result1.Step   = step1;
            result1.Result = "E36X";

            // Create the MSR step result
            RouteStationResult result2 = Xpo.CreateXPObject <RouteStationResult>();

            result2.Step   = step2;
            result2.Result = "A04";

            // Create the OpenText step result
            RouteStationResult result3 = Xpo.CreateXPObject <RouteStationResult>();

            result3.Step   = step3;
            result3.Result = "i can type whatever i want to";

            // Create a station process SCENARIO
            RouteStationProcess process =
                Xpo.CreateXPObject <RouteStationProcess>();

            // Create a fake inventory item
            InventoryItem item = Xpo.CreateXPObject <InventoryItem>();

            // Set the inventory part to the attribute part we've created.
            item.Part = part;

            // Set the process inventory item to the fake inventory item we've created.
            process.Item = item;

            // Add the results to the process
            process.Results.Add(result1);
            process.Results.Add(result2);
            process.Results.Add(result3);

            // Generate a fake process outcome
            StationOutcome outcome = Xpo.CreateXPObject <StationOutcome>();

            outcome.Label = "PASS";

            // Assign the outcome to our fake process
            process.StationOutcome = outcome;

            // Validate the process
            RouteStationProcessValidator validator =
                new RouteStationProcessValidator(process);

            Assert.IsFalse(validator.Validated());
        }
Beispiel #4
0
 private void SetupEndProcess(StationOutcome outcome)
 {
     m_process.StationOutcome = outcome;
     m_process.NextStation    = null;
     nextStationText.Text     = "End of process";
 }
Beispiel #5
0
        private bool IsMissingRequiredFields()
        {
            // Guard
            if (outcomeSelList.EditValue == null)
            {
                return(true);
            }

            // Only validate required fields if the station outcome is pass or fail
            StationOutcome outcome = (StationOutcome)outcomeSelList.EditValue;

            if (outcome.Label.Equals("NOT PERFORMED"))
            {
                return(false);
            }


            // Verify required fields are valid prior to outcome selection.
            if (!m_process.ValidRequiredFields())
            {
                MessageBox.Show(
                    "This unit cannot be routed because required results are missing.",
                    Application.ProductName, MessageBoxButtons.OK,
                    MessageBoxIcon.Exclamation);
                outcomeSelList.EditValue = null;
                return(true);
            }


            // Verify all repairs are valid
            if (m_process.Station.AllowRepairs)
            {
                foreach (RouteStationFailure failure in m_process.AllProcessFailures)
                {
                    foreach (RouteStationRepair repair in failure.Repairs)
                    {
                        if (repair.Repair != RepairAction.None && m_process.Station.IsRepairComponentsRequired)
                        {
                            if (repair.Components.Count == 0)
                            {
                                string msg = "Repair action [ " + repair.Repair +
                                             " ] for failure [ " +
                                             repair.Failure.FailCode +
                                             " ] requires a component tracking entry.";

                                Scout.Core.UserInteraction.Dialog.ShowMessage(msg, UserMessageType.Validation);
                                return(true);
                            }
                        }
                    }
                }
            }


            if (m_taskController.HasOpenTasks())
            {
                Scout.Core.UserInteraction.Dialog.ShowMessage("There are open tasks that must be completed before moving to the next station", UserMessageType.Validation);
                return(true);
            }

            return(false);
        }
Beispiel #6
0
        private void outcomeSelList_EditValueChanged(object sender, EventArgs e)
        {
            var outcome = outcomeSelList.EditValue as StationOutcome;

            Outcome = outcome;
        }