Esempio n. 1
0
        private void Setup757Total(MaintenanceDirective mpd, DataRow row, IList <AtaChapter> ata, bool isNew)
        {
            mpd.TaskNumberCheck = row[0].ToString();
            mpd.MpdRevisionNum  = row[1].ToString();
            mpd.Remarks         = row[3].ToString();

            if (isNew)
            {
                mpd.HiddenRemarks = "NEW";
            }

            if (mpd.TaskNumberCheck.Length > 2)
            {
                var shortName = mpd.TaskNumberCheck.Substring(0, 2);
                mpd.ATAChapter = ata.FirstOrDefault(a => a.ShortName.Equals(shortName));
            }

            mpd.MPDTaskNumber           = "D626A001";
            mpd.IsOperatorTask          = false;
            mpd.MpdRevisionDate         = new DateTime(2019, 2, 15);
            mpd.Threshold.EffectiveDate = new DateTime(2018, 8, 23);
            mpd.ScheduleRevisionDate    = new DateTime(2018, 8, 23);
            mpd.ScheduleRevisionNum     = "0";
            mpd.ScheduleRef             = "SC-C014-MP";
        }
Esempio n. 2
0
        /// <summary>
        /// Создает элемент управления для отображения списка SubCheck-ов
        /// </summary>
        /// <param name="directive"></param>
        public MaintenanceSubChecksListView(MaintenanceDirective directive)
        {
/*            //
 *          // listViewSubChecks
 *          //
 *          listViewSubChecks.Dock = DockStyle.Fill;
 *          listViewSubChecks.Font = Css.ListView.Fonts.RegularFont;
 *          listViewSubChecks.FullRowSelect = true;
 *          listViewSubChecks.View = View.Details;
 *          listViewSubChecks.ItemSelectionChanged += listViewSubChecks_ItemSelectionChanged;
 *          listViewSubChecks.MouseDoubleClick += listViewSubChecks_MouseDoubleClick;
 *          listViewSubChecks.ColumnClick += listViewSubChecks_ColumnClick;
 *
 *          DisplayerRequested += MaintenanceSubChecksListView_DisplayerRequested;
 *          Controls.Add(listViewSubChecks);*/


            selectedItemsList                   = new List <MaintenanceSubCheck>();
            ItemsListView.Font                  = Css.ListView.Fonts.SmallRegularFont;
            ItemsListView.ColumnClick          += listViewJobCards_ColumnClick;
            ItemsListView.MouseDoubleClick     += listViewJobCards_MouseDoubleClick;
            ItemsListView.SelectedIndexChanged += ItemsListView_SelectedIndexChanged;
            ItemsListView.PreviewKeyDown       += ItemsListView_PreviewKeyDown;
            DisplayerRequested                 += MaintenanceJobCardsListView_DisplayerRequested;
            columnIndexQueue.Enqueue(0);

            this.directive = directive;
            UpdateItems();
        }
        private void ToolStripMenuItemShowTaskCardClick(object sender, EventArgs e)
        {
            if (_directivesViewer.SelectedItems == null ||
                _directivesViewer.SelectedItems.Count == 0)
            {
                return;
            }
            MaintenanceDirective mpd = _directivesViewer.SelectedItems[0];

            if (mpd == null || mpd.TaskCardNumberFile == null)
            {
                MessageBox.Show("Not set Task Card File", (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }

            try
            {
                string message;
                GlobalObjects.CasEnvironment.OpenFile(mpd.TaskCardNumberFile, out message);
                if (message != "")
                {
                    MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"],
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                string errorDescriptionSctring =
                    $"Error while Open Attached File for {mpd}, id {mpd.ItemId}. \nFileId {mpd.TaskCardNumberFile.ItemId}";
                Program.Provider.Logger.Log(errorDescriptionSctring, ex);
            }
        }
Esempio n. 4
0
        private void ButtonDeleteClick(object sender, EventArgs e)
        {
            if (listViewBindedTasks.SelectedItems.Count == 0)
            {
                return;
            }

            foreach (BaseEntityObject selectedItem in listViewBindedTasks.SelectedItems)
            {
                MaintenanceDirective dir = selectedItem as MaintenanceDirective;
                if (dir == null)
                {
                    continue;
                }

                try
                {
                    dir.MaintenanceCheck = null;

                    GlobalObjects.CasEnvironment.NewKeeper.Save(dir, false);

                    _maintenanceCheck.BindMpds.RemoveById(dir.ItemId);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while delete bind task record", ex);
                }
            }

            _animatedThreadWorker.RunWorkerAsync();
        }
Esempio n. 5
0
        private void ChangeItemRelations(ref ItemsRelation itemsRelation, MaintenanceDirective relatedItem, WorkItemsRelationTypeUI relationTypeUI)
        {
            if (relatedItem.ItemRelations.Count == 0 ||
                relatedItem.ItemRelations.IsAllRelationWith(SmartCoreType.ComponentDirective))
            {
                if (itemsRelation == null)
                {
                    itemsRelation = new ItemsRelation();
                    _currentComponentDirective.ItemRelations.Add(itemsRelation);
                }
                else
                {
                    _lastBindedMpd.ItemRelations.Remove(itemsRelation);
                }

                itemsRelation.FillParameters(_currentComponentDirective, relatedItem);
                if (!RelateditemContainsLinkOnCurrentItem(_currentComponentDirective, relatedItem))
                {
                    relatedItem.ItemRelations.Add(itemsRelation);
                }

                itemsRelation.RelationTypeId = ItemRelationHelper.ConvertUIItemRelationToBLItem(relationTypeUI, _currentComponentDirective.IsFirst);
            }
            else
            {
                ItemRelationHelper.ShowDialogIfItemHaveLinkWithAnotherItem($"MPD {relatedItem.MPDNumber}", "AD", "Component");
            }
        }
Esempio n. 6
0
        private void HeaderControlButtonSaveAndAddClick(object sender, EventArgs e)
        {
            string message;

            if (!ValidateData(out message))
            {
                message += "\nAbort operation";
                MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (GetChangeStatus())
            {
                SaveData();
            }

            if (MessageBox.Show("Directive added successfully" + "\nClear Fields before add new directive?",
                                new GlobalTermsProvider()["SystemName"].ToString(),
                                MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
            {
                ClearFields();
            }
            BaseComponent bd = _currentDirective.ParentBaseComponent;

            _currentDirective = new MaintenanceDirective {
                ParentBaseComponent = bd
            };
        }
Esempio n. 7
0
        /// <summary>
        /// Возвращает значение, показывающее были ли изменения в данном элементе управления
        /// </summary>
        public bool GetChangeStatus(MaintenanceDirective directive)
        {
            double manHours;
            double elapsed;
            double cost;

            if (!CheckDoubleValue("Man Hours", textBoxManHours.Text, out manHours))
            {
                return(false);
            }
            if (!CheckDoubleValue("Elapsed", textBoxElapsed.Text, out elapsed))
            {
                return(false);
            }
            if (!CheckDoubleValue("Cost", textBoxCost.Text, out cost))
            {
                return(false);
            }

            MaintenanceDirectiveThreshold threshold = new MaintenanceDirectiveThreshold();

            threshold.EffectiveDate                      = _effDate;
            threshold.FirstPerformanceSinceNew           = new Lifelength(lifelengthViewer_SinceNew.Lifelength);
            threshold.FirstPerformanceSinceEffectiveDate = new Lifelength(lifelengthViewer_SinceEffDate.Lifelength);
            threshold.FirstNotification                  = new Lifelength(lifelengthViewer_FirstNotify.Lifelength);
            threshold.RepeatInterval                     = new Lifelength(lifelengthViewer_Repeat.Lifelength);
            threshold.RepeatNotification                 = new Lifelength(lifelengthViewer_RepeatNotify.Lifelength);
            threshold.FirstPerformanceConditionType      = radio_FirstWhicheverFirst.Checked
                                                                                                          ? ThresholdConditionType.WhicheverFirst
                                                                                                          : ThresholdConditionType.WhicheverLater;
            threshold.RepeatPerformanceConditionType = radio_RepeatWhicheverFirst.Checked
                                                                                                          ? ThresholdConditionType.WhicheverFirst
                                                                                                          : ThresholdConditionType.WhicheverLater;

            try
            {
                if (directive.MaintenanceCheck == null && lookupComboboxMaintenanceCheck.SelectedItemId > 0 ||
                    directive.MaintenanceCheck != null && lookupComboboxMaintenanceCheck.SelectedItemId != directive.MaintenanceCheck.ItemId ||
                    directive.ManHours != manHours ||
                    directive.Elapsed != elapsed ||
                    directive.Cost != cost ||
                    checkBoxAPU.Checked != directive.APUCalc ||
                    checkBoxSBControl.Checked != directive.IsSBControl ||
                    directive.NDTType.ItemId != ((NDTType)comboBoxNdt.SelectedItem).ItemId ||
                    directive.Skill.ItemId != ((Skill)comboBoxSkill.SelectedItem).ItemId ||
                    directive.IsClosed != IsClosed ||
                    directive.Threshold.ToString() != threshold.ToString() ||
                    directive.WorkType != comboBoxWorkType.SelectedItem ||
                    directive.KitsApplicable != checkBoxKitsApplicable.Checked)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(true);
            }
            return(false);
        }
Esempio n. 8
0
        private void ViewJobCard(MaintenanceDirective selectedMpd, AttachedFile attachedFile)
        {
            if (attachedFile == null)
            {
                MessageBox.Show("Not set Job Card File", (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                return;
            }

            try
            {
                string message;
                GlobalObjects.CasEnvironment.OpenFile(attachedFile, out message);
                if (message != "")
                {
                    MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"],
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                }
            }
            catch (Exception ex)
            {
                var errorDescriptionSctring = $"Error while Open Attached File for {selectedMpd}, id {selectedMpd.ItemId}. \nFileId {attachedFile.ItemId}";
                Program.Provider.Logger.Log(errorDescriptionSctring, ex);
            }
        }
Esempio n. 9
0
        private void LookupComboboxMaintenanceDirectiveSelectedIndexChanged(object sender, EventArgs e)
        {
            if (lookupComboboxMaintenanceDirective.SelectedItem != null)
            {
                MaintenanceDirective          md  = (MaintenanceDirective)lookupComboboxMaintenanceDirective.SelectedItem;
                MaintenanceDirectiveThreshold mdt = md.Threshold;
                comboBoxMpdTaskType.SelectedItem             = md.WorkType;
                lifelengthViewer_FirstPerformance.Lifelength = new Lifelength(mdt.FirstPerformanceSinceNew);
                lifelengthViewer_FirstNotify.Lifelength      = new Lifelength(mdt.FirstNotification);
                lifelengthViewerRptInterval.Lifelength       = new Lifelength(mdt.RepeatInterval);
                lifelengthViewerRptNotify.Lifelength         = new Lifelength(mdt.RepeatNotification);
                radio_WhicheverFirst.Checked = true;

                lifelengthViewer_FirstPerformance.Enabled = false;
                lifelengthViewer_FirstNotify.Enabled      = false;
                lifelengthViewerRptInterval.Enabled       = false;
                lifelengthViewerRptNotify.Enabled         = false;
                radio_WhicheverFirst.Enabled = false;
                radio_WhicheverLater.Enabled = false;
            }
            else
            {
                lifelengthViewer_FirstPerformance.Enabled = true;
                lifelengthViewer_FirstNotify.Enabled      = true;
                lifelengthViewerRptInterval.Enabled       = true;
                lifelengthViewerRptNotify.Enabled         = true;
                radio_WhicheverFirst.Enabled = true;
                radio_WhicheverLater.Enabled = true;
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Возвращает DisplayerParams для MaintenanceDirective
        /// </summary>
        public static DisplayerParams GetMaintenanceDirectiveScreen(MaintenanceDirective mpd)
        {
            string   regNumber;
            Aircraft parentAircraft = null;

            if (mpd.ParentBaseComponent.LastDestinationObjectType == SmartCoreType.Aircraft)
            {
                parentAircraft = GlobalObjects.AircraftsCore.GetAircraftById(mpd.ParentBaseComponent.LastDestinationObjectId);
            }
            if (mpd.ParentBaseComponent.BaseComponentType == BaseComponentType.Frame)
            {
                regNumber = mpd.ParentBaseComponent.GetParentAircraftRegNumber();
            }
            else
            {
                if (parentAircraft != null)
                {
                    regNumber = $"{parentAircraft.RegistrationNumber}. {mpd.ParentBaseComponent}";
                }
                else
                {
                    regNumber = mpd.ParentBaseComponent.ToString();
                }
            }
            regNumber += $". MPD. {mpd.WorkType.CommonName}. {mpd.TaskNumberCheck}";

            return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, regNumber, new MaintenanceDirectiveScreen(mpd)));
        }
Esempio n. 11
0
 /// <summary>
 /// Создается форма добавления подчека
 /// </summary>
 /// <param name="directive">Maintenance Directive</param>
 public MaintenanceSubCheckForm(MaintenanceDirective directive)
 {
     this.directive = directive;
     this.view      = SubCheckFormView.Add;
     InitializeComponent();
     Initialize();
     Text = ((Aircraft)directive.Parent).RegistrationNumber + ". Add subcheck";
 }
Esempio n. 12
0
        /// <summary>
        /// Применение изменений
        /// </summary>
        /// <returns></returns>
        public void ApplyChanges(MaintenanceDirective directive)
        {
            double manHours;
            double elapsed;
            double cost;

            if (!CheckDoubleValue("Man Hours", textBoxManHours.Text, out manHours))
            {
                return;
            }
            if (!CheckDoubleValue("Elapsed", textBoxElapsed.Text, out elapsed))
            {
                return;
            }
            if (!CheckDoubleValue("Cost", textBoxCost.Text, out cost))
            {
                return;
            }
            directive.MaintenanceCheck = lookupComboboxMaintenanceCheck.SelectedItem as MaintenanceCheck;
            directive.WorkType         = ((MaintenanceDirectiveTaskType)comboBoxWorkType.SelectedItem);
            directive.ManHours         = manHours;
            directive.Elapsed          = elapsed;
            directive.Cost             = cost;
            directive.IsClosed         = IsClosed;
            directive.NDTType          = comboBoxNdt.SelectedItem as NDTType;
            directive.Skill            = comboBoxSkill.SelectedItem as Skill;
            directive.KitsApplicable   = checkBoxKitsApplicable.Checked;
            directive.APUCalc          = checkBoxAPU.Checked;
            directive.IsSBControl      = checkBoxSBControl.Checked;
            if (!checkBoxKitsApplicable.Checked && directive.Kits.Count > 0)
            {
                foreach (var kit in directive.Kits)
                {
                    kit.IsDeleted = true;
                }
            }

            var threshold = new MaintenanceDirectiveThreshold
            {
                EffectiveDate                      = _effDate,
                FirstPerformanceSinceNew           = new Lifelength(lifelengthViewer_SinceNew.Lifelength),
                FirstPerformanceSinceEffectiveDate = new Lifelength(lifelengthViewer_SinceEffDate.Lifelength),
                FirstNotification                  = new Lifelength(lifelengthViewer_FirstNotify.Lifelength),
                RepeatInterval                     = new Lifelength(lifelengthViewer_Repeat.Lifelength),
                RepeatNotification                 = new Lifelength(lifelengthViewer_RepeatNotify.Lifelength),
                FirstPerformanceConditionType      = radio_FirstWhicheverFirst.Checked
                                        ? ThresholdConditionType.WhicheverFirst
                                        : ThresholdConditionType.WhicheverLater,
                RepeatPerformanceConditionType = radio_RepeatWhicheverFirst.Checked
                                        ? ThresholdConditionType.WhicheverFirst
                                        : ThresholdConditionType.WhicheverLater
            };

            if (directive.Threshold.ToString() != threshold.ToString())
            {
                directive.Threshold = threshold;
            }
        }
 public MaintenanceDirectiveView(MaintenanceDirective source)
 {
     if (source == null)
     {
         return;
     }
     Threshold          = CalcView.Threshold.ConvertForCMaintenanceDirective(source.Threshold);
     IsClosed           = source.IsClosed;
     PerformanceRecords = new List <DirectiveRecordView>(source.PerformanceRecords?.Select(i => new DirectiveRecordView(i)));
 }
Esempio n. 14
0
        private void AddListViewItem(AbstractRecord record, string[] subs, WorkPackage workPackage)
        {
            Color foreColor = Color.Black;

            if (record is ActualStateRecord)
            {
                foreColor = Color.FromArgb(0, 122, 122, 122);
            }

            ListViewItem newItem = new ListViewItem(subs)
            {
                Group     = listViewCompliance.Groups[1],
                Tag       = record,
                ForeColor = foreColor
            };

            if (record is AbstractPerformanceRecord)
            {
                AbstractPerformanceRecord apr = (AbstractPerformanceRecord)record;
                if (workPackage != null)
                {
                    //запись о выполнении блокируется найденым пакетом
                    apr.DirectivePackage = workPackage;
                    newItem.BackColor    = Color.FromArgb(Highlight.Grey.Color);
                    newItem.ToolTipText  =
                        "Perform of the task:" + apr.Parent +
                        "\nadded by Work Package:" +
                        "\n" + apr.DirectivePackage.Title +
                        "\nTo remove a performance of task, you need to exclude task from this work package," +
                        "\nor delete the work package ";
                }
                else if (apr is DirectiveRecord)
                {
                    DirectiveRecord dr = apr as DirectiveRecord;
                    if (dr.MaintenanceDirectiveRecordId > 0)
                    {
                        DirectiveRecord mdr = GlobalObjects.CasEnvironment.NewLoader.GetObjectById <DirectiveRecordDTO, DirectiveRecord>(dr.MaintenanceDirectiveRecordId);
                        if (mdr != null && mdr.ParentType == SmartCoreType.MaintenanceDirective)
                        {
                            MaintenanceDirective md = GlobalObjects.MaintenanceCore.GetMaintenanceDirective(mdr.ParentId);
                            if (md != null)
                            {
                                newItem.ToolTipText =
                                    "Perform of the task:" + dr.WorkType +
                                    "\nadded by MPD Item:" +
                                    "\n" + md.TaskNumberCheck;
                            }
                        }
                    }
                }
            }
            //listViewCompliance.Items.Insert(index, newItem);
            listViewCompliance.Items.Add(newItem);
        }
        /// <summary>
        /// Создает элемент управления для задания ограничений <see cref="MaintenanceDirective"/>
        /// </summary>
        /// <param name="directive">Директива</param>
        public MaintenanceStatusLimitationsControl(MaintenanceDirective directive)
        {
            this.directive         = directive;
            infoViewerMaxResource  = new InfoViewer(directive.Limitations.Length);
            infoViewerNotification = new InfoViewer(directive.Limitations.Length);
            for (int i = 0; i < directive.Limitations.Length; i++)
            {
                CheckBox checkBox = new CheckBox();
                checkBox.Font            = Css.OrdinaryText.Fonts.RegularFont;
                checkBox.ForeColor       = Css.OrdinaryText.Colors.ForeColor;
                checkBox.Location        = new Point(LEFT_MARGIN, TOP_MARGIN + i * checkBoxSize.Height);
                checkBox.Size            = checkBoxSize;
                checkBox.CheckedChanged += MaintenanceStatusLimitationsControl_CheckedChanged;
                checkBoxs.Add(checkBox);
            }
            //
            // infoViewerMaxResource
            //
            infoViewerMaxResource.Location = new Point(LEFT_MARGIN + checkBoxSize.Width, 0);
            infoViewerMaxResource.LifeLengthViewers[0].ShowHeaders = true;
            infoViewerMaxResource.LeftHeaderWidth = 0;
            infoViewerMaxResource.LabelTitle.Text = "Maintenance Intervals";
            infoViewerMaxResource.FirstLifelengthViewerLostFocusByShiftTabClicked = true;
            infoViewerMaxResource.ShowMinutes = false;
            infoViewerMaxResource.LastLifelengthViewerTabClicked       += maxResourcesInfo_LastLifelengthViewerTabClicked;
            infoViewerMaxResource.FirstLifelengthViewerShiftTabClicked += maxResourcesInfo_FirstLifelengthViewerShiftTabClicked;
            //
            // infoViewerNotification
            //
            infoViewerNotification.Location = new Point(infoViewerMaxResource.Right + WIDTH_INTERVAL, 0);
            infoViewerNotification.LifeLengthViewers[0].ShowHeaders = true;
            infoViewerNotification.LeftHeaderWidth = 0;
            infoViewerNotification.LabelTitle.Text = "Notification";
            infoViewerNotification.LastLifelengthViewerLostFocusByTabClicked = true;
            infoViewerNotification.ShowMinutes = false;
            infoViewerNotification.LastLifelengthViewerTabClicked       += notifyWhenRemainsInfo_LastLifelengthViewerTabClicked;
            infoViewerNotification.FirstLifelengthViewerShiftTabClicked += notifyWhenRemainsInfo_FirstLifelengthViewerShiftTabClicked;
            //
            // linkEditSubChecks
            //
            linkEditSubChecks.AutoSize = true;
            Css.SimpleLink.Adjust(linkEditSubChecks);
            linkEditSubChecks.Text                = "Edit Subchecks";
            linkEditSubChecks.Location            = new Point(LEFT_MARGIN_FOR_LINK, infoViewerMaxResource.Bottom + HEIGHT_INTERVAL);
            linkEditSubChecks.DisplayerRequested += linkEditSubChecks_DisplayerRequested;

            BackColor = Css.CommonAppearance.Colors.BackColor;
            AutoSize  = true;
            Controls.AddRange(checkBoxs.ToArray());
            Controls.Add(infoViewerMaxResource);
            Controls.Add(infoViewerNotification);
            Controls.Add(linkEditSubChecks);
        }
Esempio n. 16
0
        ///<summary>
        /// Создает страницу для отображения информации об одной директиве
        ///</summary>
        /// <param name="maintenanceDirective">Директива</param>
        public MaintenanceDirectiveScreen(MaintenanceDirective maintenanceDirective)
            : this()
        {
            if (maintenanceDirective == null)
            {
                throw new ArgumentNullException("maintenanceDirective", "Argument cannot be null");
            }

            _currentDirective = maintenanceDirective;

            Initialize();
        }
Esempio n. 17
0
        /// <summary>
        /// Создает форму для привязки задач к выполнению чека программы обслуживания
        /// </summary>
        public MaintenanceDirectiveBindComponentForm(MaintenanceDirective maintenanceDirective)
            : this()
        {
            if (maintenanceDirective == null)
            {
                throw new ArgumentNullException("maintenanceDirective", "must be not null");
            }
            _maintenanceDirective = maintenanceDirective;
            _currentAircraft      = GlobalObjects.AircraftsCore.GetAircraftById(maintenanceDirective.ParentBaseComponent.ParentAircraftId);

            _animatedThreadWorker.DoWork             += AnimatedThreadWorkerDoLoad;
            _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted;
        }
        private void AddListViewItem(AbstractPerformanceRecord apr, WorkPackage workPackage)
        {
            DirectiveRecord directiveRecord = (DirectiveRecord)apr;

            string           workTypeString = "";
            StaticDictionary workType;

            if (directiveRecord.Parent is MaintenanceDirective)
            {
                MaintenanceDirective parentDirective = (MaintenanceDirective)directiveRecord.Parent;
                workType       = parentDirective.WorkType;
                workTypeString = parentDirective.WorkType.ToString();
            }
            else if (directiveRecord.Parent is ComponentDirective)
            {
                ComponentDirective parentDirective = (ComponentDirective)directiveRecord.Parent;
                workType       = parentDirective.DirectiveType;
                workTypeString = parentDirective.DirectiveType + " of " + parentDirective.ParentComponent.Description;
            }
            else
            {
                workType = MaintenanceDirectiveTaskType.Unknown;
            }
            string[] subs = new[]  {
                workTypeString,
                UsefulMethods.NormalizeDate(directiveRecord.RecordDate),
                directiveRecord.OnLifelength != null
                                           ? directiveRecord.OnLifelength.ToString()
                                           : "",
                directiveRecord.Remarks,
            };
            ListViewItem newItem = new ListViewItem(subs)
            {
                Group = listViewCompliance.Groups[1],
                Tag   = directiveRecord
            };

            if (workPackage != null)
            {
                //запись о выполнении блокируется найденым пакетом
                apr.DirectivePackage = workPackage;
                newItem.BackColor    = Color.FromArgb(Highlight.Grey.Color);
                newItem.ToolTipText  =
                    "Perform of the task:" + workType +
                    "\nadded by Work Package:" +
                    "\n" + directiveRecord.DirectivePackage.Title +
                    "\nTo remove a performance of task, you need to exclude task from this work package," +
                    "\nor delete the work package ";
            }
            listViewCompliance.Items.Add(newItem);
        }
Esempio n. 19
0
        private void AddJobCard()
        {
            if (listViewMaintenanceChecks.SelectedItems.Count == 0)
            {
                MessageBox.Show("Indicate Maintenance Check",
                                (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }
            if (listViewTasksForSelect.SelectedItems.Count == 0)
            {
                MessageBox.Show("Indicate Tasks for bind to Check",
                                (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                return;
            }

            MaintenanceCheck maintenanceCheck = (MaintenanceCheck)listViewMaintenanceChecks.SelectedItems[0].Tag;

            foreach (BaseEntityObject selectedItem in listViewTasksForSelect.SelectedItems)
            {
                MaintenanceDirective dir = selectedItem as MaintenanceDirective;
                if (dir == null)
                {
                    continue;
                }

                try
                {
                    dir.MaintenanceCheck = maintenanceCheck;

                    GlobalObjects.CasEnvironment.NewKeeper.Save(dir, false);

                    maintenanceCheck.BindMpds.Add(dir);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while save bind task record", ex);
                }
            }

            listViewBindedTasks.SetItemsArray(_allDirectives.Where(mpd => maintenanceCheck.Equals(mpd.MaintenanceCheck)).ToArray());

            _mpdForSelect = _allDirectives.Where(mpd => mpd.MaintenanceCheck == null).ToList();

            listViewTasksForSelect.SetItemsArray(_mpdForSelect.ToArray());
        }
        private void ButtonEditClick(object sender, EventArgs e)
        {
            if (listViewCompliance.SelectedItems.Count == 0 || listViewCompliance.SelectedItems[0].Tag is MaintenanceDirective)
            {
                return;
            }

            DirectiveComplianceDialog dlg;
            DirectiveRecord           record;

            if (listViewCompliance.SelectedItems[0].Tag is DirectiveRecord)
            {
                record = (DirectiveRecord)listViewCompliance.SelectedItems[0].Tag;
                IDirective directive = record.Parent;

                if (directive is MaintenanceDirective)
                {
                    MaintenanceDirective parentDirective = (MaintenanceDirective)directive;
                    dlg = new DirectiveComplianceDialog(record.Parent, record)
                    {
                        Text = "Edit exist compliance for " + parentDirective.WorkType
                    };
                    dlg.ShowDialog();

                    if (dlg.DialogResult == DialogResult.OK)
                    {
                        InvokeComplianceAdded(null);
                    }
                }
                else if (directive is ComponentDirective)
                {
                    ComponentDirective parentDirective = (ComponentDirective)directive;
                    dlg = new DirectiveComplianceDialog(record.Parent, record)
                    {
                        Text = "Edit exist compliance for " + parentDirective.DirectiveType + " of " + parentDirective.ParentComponent.Description
                    };
                    dlg.ShowDialog();

                    if (dlg.DialogResult == DialogResult.OK)
                    {
                        InvokeComplianceAdded(null);
                    }
                }
            }
            else
            {
                return;
            }
        }
        private void AddListViewItem(AbstractPerformanceRecord apr, WorkPackage workPackage,
                                     MaintenanceCheckRecord mcr)
        {
            DirectiveRecord      directiveRecord = (DirectiveRecord)apr;
            MaintenanceDirective parentDirective = (MaintenanceDirective)directiveRecord.Parent;

            string[] subs = new[]  {
                parentDirective.WorkType.ToString(),
                     UsefulMethods.NormalizeDate(directiveRecord.RecordDate),
                directiveRecord.OnLifelength != null
                                                   ? directiveRecord.OnLifelength.ToString()
                                                   : "",
                "",
                "",
                directiveRecord.Remarks,
            };

            ListViewItem newItem = new ListViewItem(subs)
            {
                Group = listViewCompliance.Groups[1],
                Tag   = directiveRecord
            };

            if (workPackage != null)
            {
                //запись о выполнении блокируется найденым пакетом
                apr.DirectivePackage = workPackage;
                newItem.BackColor    = Color.FromArgb(Highlight.Grey.Color);
                newItem.ToolTipText  =
                    "Perform of the task:" + parentDirective.WorkType +
                    "\nadded by Work Package:" +
                    "\n" + directiveRecord.DirectivePackage.Title +
                    "\nTo remove a performance of task, you need to exclude task from this work package," +
                    "\nor delete the work package ";
            }
            else if (directiveRecord.MaintenanceCheckRecordId > 0 && mcr != null && mcr.ParentCheck != null)
            {
                MaintenanceCheck mc = mcr.ParentCheck;
                directiveRecord.MaintenanceCheck = mc;
                newItem.BackColor   = Color.FromArgb(Highlight.Grey.Color);
                newItem.ToolTipText =
                    "Perform of the task:" + parentDirective.WorkType +
                    "\nadded by Maintenance Check:" +
                    "\n" + mc.Name +
                    "\nTo remove a performance of task, you need to delete performance of maintenance check";
            }
            listViewCompliance.Items.Add(newItem);
        }
Esempio n. 22
0
        ///<summary>
        /// Создает страницу для отображения информации об одной директиве
        ///</summary>
        /// <param name="parent">Директива</param>
        public JobCardScreen(MaintenanceDirective parent)
            : this()
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent", "Argument cannot be null");
            }

            CurrentAircraft = GlobalObjects.AircraftsCore.GetAircraftById(parent.ParentBaseComponent.ParentAircraftId);//TODO:(Evgenii Babak) пересмотреть использование ParentAircrafId здесь

            _currentItem = new JobCard {
                Parent = parent
            };

            Initialize();
        }
Esempio n. 23
0
        private ItemsRelation CreateItemRelation(MaintenanceDirective mpd, WorkItemsRelationTypeUI relationTypeUI)
        {
            var itemRelation = new ItemsRelation();
            var relationType = ItemRelationHelper.ConvertUIItemRelationToBLItem(relationTypeUI, _directive.IsFirst);

            if (_directive.IsFirst == true)
            {
                itemRelation.FillParameters(_directive, mpd, relationType);
            }
            else
            {
                itemRelation.FillParameters(mpd, _directive, relationType);
            }

            return(itemRelation);
        }
Esempio n. 24
0
        ///<summary>
        /// Создает страницу для отображения информации об одной директиве
        ///</summary>
        /// <param name="aircraft">Директива</param>
        public MaintenanceDirectiveScreen(Aircraft aircraft)
            : this()
        {
            if (aircraft == null)
            {
                throw new ArgumentNullException("aircraft", "Argument cannot be null");
            }

            var aircraftFrame = GlobalObjects.ComponentCore.GetBaseComponentById(aircraft.AircraftFrameId);

            _currentDirective = new MaintenanceDirective {
                ParentBaseComponent = aircraftFrame
            };

            Initialize();
        }
        private void InitListView()
        {
            _directivesViewer                       = new MaintenanceDirectiveFleetListView();
            _directivesViewer.TabIndex              = 2;
            _directivesViewer.Location              = new Point(panel1.Left, panel1.Top);
            _directivesViewer.Dock                  = DockStyle.Fill;
            _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged;
            Controls.Add(_directivesViewer);
            //события
            _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged;

            _directivesViewer.AddMenuItems(_toolStripMenuItemOpen,
                                           _toolStripMenuItemShowTaskCard);

            _directivesViewer.MenuOpeningAction = () =>
            {
                if (_directivesViewer.SelectedItems.Count <= 0)
                {
                    _toolStripMenuItemOpen.Enabled         = false;
                    _toolStripMenuItemShowTaskCard.Enabled = false;
                }
                if (_directivesViewer.SelectedItems.Count == 1)
                {
                    _toolStripMenuItemOpen.Enabled = true;

                    MaintenanceDirective mpd = _directivesViewer.SelectedItems[0];
                    if (mpd != null && mpd.TaskCardNumberFile != null)
                    {
                        _toolStripMenuItemShowTaskCard.Enabled = true;
                    }
                    else
                    {
                        _toolStripMenuItemShowTaskCard.Enabled = false;
                    }
                }

                if (_directivesViewer.SelectedItems.Count > 0)
                {
                    _toolStripMenuItemOpen.Enabled         = true;
                    _toolStripMenuItemShowTaskCard.Enabled = true;
                }
            };

            panel1.Controls.Add(_directivesViewer);
        }
Esempio n. 26
0
        public void DeleteDirectiveRecordTest()
        {
            var enviroment      = GetEnviroment();
            var performanceCore = new PerformanceCore(enviroment.NewKeeper, enviroment.Keeper, enviroment.Calculator, null);

            var mpd = new MaintenanceDirective
            {
                Remarks = "Test"
            };

            enviroment.NewKeeper.Save(mpd);

            var directiveRecordForMpdFirst = new DirectiveRecord
            {
                MaintenanceDirectiveRecordId = mpd.ItemId,
                Parent  = mpd,
                Remarks = "Test"
            };

            enviroment.NewKeeper.Save(directiveRecordForMpdFirst);

            var directiveRecordForMpdSecond = new DirectiveRecord
            {
                MaintenanceDirectiveRecordId = directiveRecordForMpdFirst.ItemId,
                Remarks = "Test"
            };

            enviroment.NewKeeper.Save(directiveRecordForMpdSecond);


            performanceCore.Delete(directiveRecordForMpdFirst);

            //Загрузка 1 и 2 DirectiveRecord
            var forCheckFirst  = enviroment.NewLoader.GetObject <DirectiveRecordDTO, DirectiveRecord>(new Filter("ItemId", directiveRecordForMpdFirst.ItemId), getDeleted: true);
            var forCheckSecond = enviroment.NewLoader.GetObject <DirectiveRecordDTO, DirectiveRecord>(new Filter("MaintenanceDirectiveRecordId", directiveRecordForMpdFirst.ItemId), getDeleted: true);

            //Проверка что оба DirectiveRecord - a помечены как удаленные
            Assert.IsTrue(forCheckFirst.IsDeleted);
            Assert.IsTrue(forCheckSecond.IsDeleted);

            //Удаление из БД
            enviroment.NewKeeper.Delete(mpd);
            enviroment.NewKeeper.Delete(directiveRecordForMpdFirst, false, false);
            enviroment.NewKeeper.Delete(directiveRecordForMpdSecond, false, false);
        }
Esempio n. 27
0
        /// <summary>
        /// Возвращает SubCheck-и, кототые можно присоединить
        /// </summary>
        /// <returns></returns>
        public List <MaintenanceSubCheck> GetAvailableSubChecks()
        {
            MaintenanceDirective       directive  = (MaintenanceDirective)subCheck.Parent.Parent;
            MaintenanceLimitation      limitation = (MaintenanceLimitation)subCheck.Parent;
            List <MaintenanceSubCheck> subChecks  = new List <MaintenanceSubCheck>();

            for (int i = 0; i < directive.Limitations.Length; i++)
            {
                for (int j = 0; j < directive.Limitations[i].SubChecks.Count; j++)
                {
                    if (directive.Limitations[i].CheckType.Priority >= limitation.CheckType.Priority && directive.Limitations[i].SubChecks[j] != subCheck && !directive.Limitations[i].SubChecks[j].JoinedSubChecks.Contains(subCheck))
                    {
                        subChecks.Add(directive.Limitations[i].SubChecks[j]);
                    }
                }
            }
            return(subChecks);
        }
Esempio n. 28
0
        private void CreateAndSavePerformanceForBindedItems(MaintenanceDirective mpd, AbstractPerformanceRecord performance)
        {
            var bindedItems = _bindedItemsCore.GetBindedItemsFor(mpd.ParentBaseComponent.ParentAircraftId, mpd);

            foreach (var bindedItem in bindedItems)
            {
                if (bindedItem is ComponentDirective)
                {
                    var componentDirective = (ComponentDirective)bindedItem;
                    var newPerformance     = new DirectiveRecord(performance)
                    {
                        MaintenanceDirectiveRecordId = performance.ItemId,
                        Parent = componentDirective,
                        //TODO:(Evgenii Babak) Выяснить почему при создании записи берем наработку на начало дня, но в отчетах, для записей о выполнении пересчитываем наработку, и выводим наработку на конец дня
                        OnLifelength = _calculator.GetFlightLifelengthOnStartOfDay(componentDirective.ParentComponent, performance.RecordDate),
                        ParentId     = componentDirective.ItemId
                    };
                    _newKeeper.Save(newPerformance, false);
                }
            }
        }
Esempio n. 29
0
        public void SmartCoreFileTest_MaintenanceDirective()
        {
            var enviroment = GetEnviroment();

            var maintenanceDirective = new MaintenanceDirective
            {
                MaintenanceManualFile = new AttachedFile {
                    FileName = "MaintenanceManualFile.test"
                },
                TaskNumberCheckFile = new AttachedFile {
                    FileName = "TaskNumberCheckFile.test"
                },
                MRBFile = new AttachedFile {
                    FileName = "MRBFile.test"
                },
                TaskCardNumberFile = new AttachedFile {
                    FileName = "TaskCardNumberFile.test"
                }
            };

            enviroment.NewKeeper.Save(maintenanceDirective);

            Assert.IsTrue(maintenanceDirective.ItemId > 0, "ItemId должен быть больше 0");

            var forCheck = enviroment.NewLoader.GetObject <MaintenanceDirectiveDTO, MaintenanceDirective>(new Filter("ItemId", maintenanceDirective.ItemId), true);

            enviroment.NewKeeper.Delete(maintenanceDirective);

            Assert.IsTrue(forCheck != null, "значение не должно быть null");
            Assert.AreEqual(forCheck.Files.Count, 4, "Кол-во файлов должно быть 4");
            Assert.IsTrue(forCheck.MaintenanceManualFile != null);
            Assert.AreEqual(forCheck.MaintenanceManualFile.FileName, "MaintenanceManualFile.test");
            Assert.IsTrue(forCheck.TaskNumberCheckFile != null);
            Assert.AreEqual(forCheck.TaskNumberCheckFile.FileName, "TaskNumberCheckFile.test");
            Assert.IsTrue(forCheck.MRBFile != null);
            Assert.AreEqual(forCheck.MRBFile.FileName, "MRBFile.test");
            Assert.IsTrue(forCheck.TaskCardNumberFile != null);
            Assert.AreEqual(forCheck.TaskCardNumberFile.FileName, "TaskCardNumberFile.test");
        }
Esempio n. 30
0
        public override void DisposeScreen()
        {
            CancelAsync();

            AnimatedThreadWorker.Dispose();

            if (_itemPrintReportHistory != null)
            {
                _itemPrintReportHistory.Dispose();
            }
            if (_itemPrintReportRecords != null)
            {
                _itemPrintReportRecords.Dispose();
            }
            if (_buttonPrintMenuStrip != null)
            {
                _buttonPrintMenuStrip.Dispose();
            }

            _currentDirective = null;

            Dispose(true);
        }