///<summary>
        ///</summary>
        public DeferredCategoryAddingForm(Aircraft currentAircraft, DeferredCategory defferedCategory)
        {
            _currentAircraft  = currentAircraft;
            _defferedCategory = defferedCategory;

            InitializeComponent();

            UpdateInformation();
        }
Beispiel #2
0
        private void ComboBoxDefferedCategorySelectedIndexChanged(object sender, EventArgs e)
        {
            if (((ComboBox)sender).SelectedItem == null)
            {
                return;
            }

            DeferredCategory selectedCategory = (DeferredCategory)((ComboBox)sender).SelectedItem;

            _performanceControl.SetThresholdByCategory(selectedCategory);
        }
Beispiel #3
0
        /// <summary>
        /// Создает запись  без дополнительной информации
        /// </summary>
        public InitialOrderRecord(int rfqId, Product accessory, double quantity,
                                  BaseEntityObject parent,
                                  DateTime effDate,
                                  ComponentStatus costCondition,
                                  NextPerformance perfornamce = null,
                                  DeferredCategory category   = null) : this()
        {
            ParentPackageId = rfqId;

            if (accessory != null)
            {
                ProductId        = accessory.ItemId;
                ProductType      = accessory.SmartCoreObjectType;
                EffectiveDate    = effDate;
                DeferredCategory = category ?? DeferredCategory.Unknown;
                CostCondition    = costCondition;
                _quantity        = quantity;

                if (perfornamce != null)
                {
                    Task                    = perfornamce.Parent;
                    PackageItemId           = perfornamce.Parent.ItemId;
                    PackageItemType         = perfornamce.Parent.SmartCoreObjectType;
                    PerformanceNumFromStart = perfornamce.PerformanceNum;
                    IsSchedule              = true;
                }
                if (DeferredCategory != DeferredCategory.Unknown && DeferredCategory.Threshold != null)
                {
                    LifeLimit       = DeferredCategory.Threshold.FirstPerformanceSinceEffectiveDate;
                    LifeLimitNotify = DeferredCategory.Threshold.FirstNotification;
                    IsSchedule      = false;
                }
                if (parent != null && !parent.SmartCoreObjectType.Equals(SmartCoreType.Operator))
                {
                    DestinationObject     = parent;
                    DestinationObjectType = parent.SmartCoreObjectType;
                    DestinationObjectId   = parent.ItemId;
                }
            }
            else
            {
                PackageItemId           = -1;
                EffectiveDate           = DateTime.Today;
                costCondition           = ComponentStatus.Unknown;
                PackageItemType         = SmartCoreType.Unknown;
                DeferredCategory        = DeferredCategory.Unknown;
                _quantity               = 0;
                Task                    = null;
                ProductId               = -1;
                ProductType             = SmartCoreType.Unknown;
                PerformanceNumFromStart = -1;
                IsSchedule              = false;
            }
        }
        private void ButtonDeleteClick(object sender, EventArgs e)
        {
            if (listViewDefferedCategories.SelectedItems.Count > 0)
            {
                for (int i = 0; i < listViewDefferedCategories.SelectedItems.Count; i++)
                {
                    DeferredCategory item = (DeferredCategory)listViewDefferedCategories.SelectedItems[i].Tag;
                    GlobalObjects.CasEnvironment.Manipulator.Delete(item);
                }

                UpdateInformation();
            }
        }
Beispiel #5
0
 public static DefferedCategorieDTO Convert(this DeferredCategory defferedcategorie)
 {
     return(new DefferedCategorieDTO
     {
         ItemId = defferedcategorie.ItemId,
         IsDeleted = defferedcategorie.IsDeleted,
         Updated = defferedcategorie.Updated,
         CorrectorId = defferedcategorie.CorrectorId,
         CategoryName = defferedcategorie.FullName,
         AircraftModelId = defferedcategorie.AircraftModel?.ItemId,
         Threshold = defferedcategorie.Threshold?.ToBinary()
     });
 }
 ///<summary>
 /// Возаращает первую букву в названии категории
 ///</summary>
 ///<param name="defferedCategory"></param>
 ///<returns></returns>
 private char GetChar(DeferredCategory defferedCategory)
 {
     return(char.ToUpper(defferedCategory.FullName.ToCharArray()[0]));
 }
Beispiel #7
0
        /// <summary>
        /// Сохранение Первоначального акта ордера
        /// </summary>
        public InitialOrder AddInitialOrder(IEnumerable <KeyValuePair <Product, double> > quotationList,
                                            BaseEntityObject parent,
                                            DateTime effDate,
                                            DeferredCategory category,
                                            out string message)
        {
            if (parent == null)
            {
                message = "Not set parent." +
                          "\nFailed to create empty Initial Order";
                return(null);
            }

            if (!(parent is Aircraft) && !(parent is Operator) && !(parent is Store))
            {
                message = "Parent must be Aircraft or Store or Operator." +
                          "\nFailed to create empty Initial Order";
                return(null);
            }

            if (quotationList == null)
            {
                message = "Selected tasks not have a accessories." +
                          "\nFailed to create empty Initial Order";
                return(null);
            }

            var rqst = new InitialOrder
            {
                Description    = "",
                Status         = WorkPackageStatus.Opened,
                Author         = _casEnvironment.Operators[0].Name,
                OpeningDate    = DateTime.Today,
                PublishingDate = new DateTime(1852, 01, 01),
                ClosingDate    = new DateTime(1852, 01, 01),
                Remarks        = "",
                ParentType     = parent.SmartCoreObjectType,
                ParentId       = parent.ItemId,
                Title          = parent + "-IO-" + DateTime.Now
            };

            _newKeeper.Save(rqst);

            #region Формирование записей рабочего пакета
            foreach (var item in quotationList)
            {
                Product product  = item.Key;
                double  quantity = item.Value;

                var record =
                    rqst.PackageRecords.FirstOrDefault(r => r.PackageItemType == product.SmartCoreObjectType &&
                                                       r.PackageItemId == product.ItemId);
                if (record != null)
                {
                    record.Quantity += item.Value;
                }
                else
                {
                    record = new InitialOrderRecord(rqst.ItemId,
                                                    product,
                                                    quantity,
                                                    parent,
                                                    effDate,
                                                    ComponentStatus.New | ComponentStatus.Overhaul | ComponentStatus.Repair | ComponentStatus.Serviceable,
                                                    null,
                                                    category);
                    rqst.PackageRecords.Add(record);
                }
            }
            #endregion

            #region Сохранение рабочего пакета и его записей

            foreach (var item in rqst.PackageRecords)
            {
                item.ParentPackageId = rqst.ItemId;
                _newKeeper.Save(item);
            }

            message = "Items added successfully";

            #endregion

            return(rqst);
        }
Beispiel #8
0
        protected override List <CustomCell> GetListViewSubItems(Directive item)
        {
            var subItems = new List <CustomCell>();
            var author   = GlobalObjects.CasEnvironment.GetCorrector(item);
            //////////////////////////////////////////////////////////////////////////////////////
            //         Определение последнего выполнения директивы и KitRequiered               //
            //////////////////////////////////////////////////////////////////////////////////////
            var lastComplianceDate       = DateTimeExtend.GetCASMinDateTime();
            var nextComplianceDate       = DateTimeExtend.GetCASMinDateTime();
            var lastComplianceLifeLength = Lifelength.Zero;
            var nextComplianceRemain     = Lifelength.Null;

            string lastPerformanceString, firstPerformanceString = "N/A";

            DeferredItem     pd     = (DeferredItem)item;
            DirectiveStatus  status = pd.Status;
            DeferredCategory cat    = pd.DeferredCategory;
            //////////////////////////////////////////////////////////////////////////////////////
            //         Определение последнего выполнения директивы и KitRequiered               //
            //////////////////////////////////////////////////////////////////////////////////////

            var par = "  §: " + item.Paragraph;

            //Последнее выполнение
            if (item.LastPerformance != null &&
                item.LastPerformance.RecordDate > lastComplianceDate)
            {
                lastComplianceDate       = item.LastPerformance.RecordDate;
                lastComplianceLifeLength = item.LastPerformance.OnLifelength;
            }

            //Следующее выполнение
            //GlobalObjects.CasEnvironment.Calculator.GetNextPerformance(pd.DirectiveCollection[0]);
            var nextComplianceLifeLength = item.NextPerformanceSource;

            if (item.NextPerformanceDate != null)
            {
                nextComplianceDate = (DateTime)item.NextPerformanceDate;
            }
            if (item.Remains != null)
            {
                nextComplianceRemain = item.Remains;
            }
            if (item.Threshold.FirstPerformanceSinceNew != null && !item.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
            {
                firstPerformanceString = "s/n: " + item.Threshold.FirstPerformanceSinceNew;
            }
            if (item.Threshold.FirstPerformanceSinceEffectiveDate != null &&
                !item.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero())
            {
                if (firstPerformanceString != "N/A")
                {
                    firstPerformanceString += " or ";
                }
                else
                {
                    firstPerformanceString = "";
                }
                firstPerformanceString += "s/e.d: " + item.Threshold.FirstPerformanceSinceEffectiveDate;
            }
            var repeatInterval     = item.Threshold.RepeatInterval;
            var kitRequieredString = item.Kits.Count + " kits";
            var ndtString          = item.NDTType.ShortName;
            var workType           = item.WorkType;
            var effDate            = item.Threshold.EffectiveDate;
            var manHours           = item.ManHours;
            var cost = item.Cost;

            var remarksString       = pd.Remarks;
            var hiddenRemarksString = pd.HiddenRemarks;

            if (lastComplianceDate <= DateTimeExtend.GetCASMinDateTime())
            {
                lastPerformanceString = "N/A";
            }
            else
            {
                lastPerformanceString = lastComplianceLifeLength.ToString();
            }

            var lastDate = (lastComplianceDate <= DateTimeExtend.GetCASMinDateTime())
                                ? ""
                                : SmartCore.Auxiliary.Convert.GetDateFormat(lastComplianceDate);


            var titleString         = pd.Title != "" ? pd.Title + par : "N/A";
            var sbString            = pd.ServiceBulletinNo != "" ? pd.ServiceBulletinNo : "N/A";
            var eoString            = pd.EngineeringOrders != "" ? pd.EngineeringOrders : "N/A";
            var descriptionString   = pd.Description;
            var applicabilityString = pd.Applicability;
            var ata = pd.ATAChapter;

            var groupName = "";

            if (item is DeferredItem)
            {
                var aircraft = GlobalObjects.AircraftsCore.GetAircraftById(item.ParentBaseComponent.ParentAircraftId);

                groupName = $"{aircraft}";
            }


            subItems.Add(CreateRow(groupName, groupName));
            subItems.Add(CreateRow(titleString, titleString));
            subItems.Add(CreateRow(sbString, sbString));
            subItems.Add(CreateRow(eoString, eoString));
            subItems.Add(CreateRow(descriptionString, descriptionString));
            subItems.Add(CreateRow(applicabilityString, applicabilityString));
            subItems.Add(CreateRow(workType.ToString(), workType));
            subItems.Add(CreateRow(cat.ToString(), cat));
            subItems.Add(CreateRow(status.ToString(), status));
            subItems.Add(CreateRow(effDate > DateTimeExtend.GetCASMinDateTime()
                                ? SmartCore.Auxiliary.Convert.GetDateFormat(effDate) : "", effDate));

            subItems.Add(CreateRow(SmartCore.Auxiliary.Convert.GetDateFormat(item.NextPerformance?.PerformanceDate), item.NextPerformance?.PerformanceDate));
            subItems.Add(CreateRow(item.NextPerformance?.PerformanceSource.ToString(), item.NextPerformance?.PerformanceSource));
            subItems.Add(CreateRow(item.NextPerformance?.Remains.ToString(), item.NextPerformance?.Remains));
            subItems.Add(CreateRow(item.NextPerformance?.NextLimit.Days != null ? SmartCore.Auxiliary.Convert.GetDateFormat(item.NextPerformance?.NextPerformanceDateNew) : "", item.NextPerformance?.NextPerformanceDateNew));
            subItems.Add(CreateRow(item.NextPerformance?.NextLimit.ToString(), item.NextPerformance?.NextLimit.ToString()));
            subItems.Add(CreateRow(item.NextPerformance?.RemainLimit.ToString(), item.NextPerformance?.RemainLimit.ToString()));
            subItems.Add(CreateRow(lastDate, lastComplianceDate));
            subItems.Add(CreateRow(lastPerformanceString, lastComplianceDate));


            subItems.Add(CreateRow(ata.ToString(), ata));
            subItems.Add(CreateRow(kitRequieredString, kitRequieredString));
            subItems.Add(CreateRow(ndtString, ndtString));
            subItems.Add(CreateRow(manHours == -1 ? "" : manHours.ToString(), manHours));
            subItems.Add(CreateRow(cost == -1 ? "" : cost.ToString(), cost));
            subItems.Add(CreateRow(remarksString, remarksString));
            subItems.Add(CreateRow(hiddenRemarksString, hiddenRemarksString));
            subItems.Add(CreateRow(author, author));

            return(subItems);
        }