/// <summary> /// Получить отфильтрованные виды документов. /// </summary> /// <param name="direction">Документопоток вида документа.</param> /// <returns>Виды документов.</returns>. public static List <IDocumentKind> GetFilteredDocumentKinds(Enumeration direction) { if (DocumentKinds.Info.IsCacheable) { if (direction == Docflow.DocumentKind.DocumentFlow.Incoming) { return(DocumentKinds.GetAllCached(d => d.DocumentFlow.Value == Docflow.DocumentKind.DocumentFlow.Incoming).ToList()); } else if (direction == Docflow.DocumentKind.DocumentFlow.Outgoing) { return(DocumentKinds.GetAllCached(d => d.DocumentFlow.Value == Docflow.DocumentKind.DocumentFlow.Outgoing).ToList()); } else if (direction == Docflow.DocumentKind.DocumentFlow.Inner) { return(DocumentKinds.GetAllCached(d => d.DocumentFlow.Value == Docflow.DocumentKind.DocumentFlow.Inner).ToList()); } else if (direction == Docflow.DocumentKind.DocumentFlow.Contracts) { return(DocumentKinds.GetAllCached(d => d.DocumentFlow.Value == Docflow.DocumentKind.DocumentFlow.Contracts).ToList()); } else { return(null); } } else { return(Functions.Module.Remote.GetFilteredDocumentKinds(direction)); } }
/// <summary> /// Получить доступные виды документов. /// </summary> /// <returns>Виды документов.</returns> public virtual List <IDocumentKind> GetAvaliableDocumentKinds() { var availableDocumentKinds = new List <IDocumentKind>(); if (_obj.DocumentKinds.Any()) { availableDocumentKinds.AddRange(_obj.DocumentKinds.Select(d => d.DocumentKind)); } else if (_obj.DocumentFlow != null) { availableDocumentKinds.AddRange(DocumentKinds.GetAllCached(k => Equals(k.DocumentFlow, _obj.DocumentFlow)).ToList()); } return(availableDocumentKinds); }
public virtual void NumberFormatItemsElementValueInput(Sungero.Presentation.EnumerationValueInputEventArgs e) { // Если новый элемент - код подразделения, то проверять, что у всех подразделений заполнены коды. if (e.NewValue == DocumentRegisterNumberFormatItems.Element.DepartmentCode && Functions.DocumentRegister.Remote.HasDepartmentWithNullCode()) { e.AddWarning(DocumentRegisters.Resources.NeedFillDepartmentCodes); } // Если новый элемент - код НОР, то проверять, что у всех НОР заполнены коды. if (e.NewValue == DocumentRegisterNumberFormatItems.Element.BUCode && Functions.DocumentRegister.Remote.HasBusinessUnitWithNullCode()) { e.AddWarning(DocumentRegisters.Resources.NeedFillBusinessUnitCodes); } // Если новый элемент - код вида документа, то проверять, что у всех видов документа заполнены коды. if (e.NewValue == DocumentRegisterNumberFormatItems.Element.DocKindCode && DocumentKinds.GetAllCached() .Any(x => x.Status == CoreEntities.DatabookEntry.Status.Active && x.Code == null)) { e.AddWarning(DocumentRegisters.Resources.NeedFillDocumentKindCodes); } }
public override void Refresh(Sungero.Presentation.FormRefreshEventArgs e) { Functions.DocumentRegister.SetRequiredProperties(_obj); if (!e.IsValid) { return; } if (_obj.AccessRights.CanUpdate()) { var isNotUsed = _obj.State.IsInserted || !Functions.Module.CalculateParams(e, _obj.RegistrationGroup, false, false, true, false, _obj); _obj.State.Properties.RegistrationGroup.IsEnabled = isNotUsed && _obj.RegisterType != RegisterType.Numbering; _obj.State.Properties.RegisterType.IsEnabled = isNotUsed; _obj.State.Properties.DocumentFlow.IsEnabled = isNotUsed; var hasDocuments = !_obj.State.IsInserted && Functions.Module.CalculateParams(e, _obj.RegistrationGroup, false, false, false, true, _obj); _obj.State.Properties.NumberingPeriod.IsEnabled = !hasDocuments; _obj.State.Properties.NumberingSection.IsEnabled = !hasDocuments; if (hasDocuments) { e.AddInformation(DocumentRegisters.Resources.SectionsDisabled, DocumentRegisters.Info.Actions.ShowRegisteredDocuments); } } if (_obj.AccessRights.CanUpdate() && !_obj.State.IsInserted && _obj.RegistrationGroup != null && !Functions.Module.CalculateParams(e, _obj.RegistrationGroup, true, true, false, false, null)) { foreach (var property in _obj.State.Properties) { property.IsEnabled = false; } } // Проверить наличие разреза по ведущему документу, если он использован в номере. if (_obj.NumberFormatItems.Any(f => f.Element == DocumentRegisterNumberFormatItems.Element.LeadingNumber) && _obj.NumberingSection != DocumentRegister.NumberingSection.LeadingDocument) { e.AddWarning(DocumentRegisters.Resources.ForDocumentNumberMustAttendSection); } // Если в формате номера есть код подразделения, то проверять, что у всех подразделений заполнены коды. if (_obj.NumberFormatItems.Any(f => f.Element == DocumentRegisterNumberFormatItems.Element.DepartmentCode) && Functions.DocumentRegister.Remote.HasDepartmentWithNullCode()) { e.AddWarning(DocumentRegisters.Resources.NeedFillDepartmentCodes); } // Если в формате номера есть код НОР, то проверять, что у всех НОР заполнены коды. if (_obj.NumberFormatItems.Any(f => f.Element == DocumentRegisterNumberFormatItems.Element.BUCode) && Functions.DocumentRegister.Remote.HasBusinessUnitWithNullCode()) { e.AddWarning(DocumentRegisters.Resources.NeedFillBusinessUnitCodes); } // Если в формате номера есть код вида документа, то проверять, что у всех видов документа заполнены коды. if (_obj.NumberFormatItems.Any(f => f.Element == DocumentRegisterNumberFormatItems.Element.DocKindCode) && DocumentKinds.GetAllCached() .Any(x => x.Status == CoreEntities.DatabookEntry.Status.Active && x.Code == null)) { e.AddWarning(DocumentRegisters.Resources.NeedFillDocumentKindCodes); } }
public override void Refresh(Sungero.Presentation.FormRefreshEventArgs e) { if (!e.IsValid) { return; } _obj.State.Properties.DocumentRegister.IsEnabled = _obj.DocumentFlow != null; _obj.State.Properties.DocumentKinds.IsEnabled = _obj.DocumentFlow != null; if (_obj.AccessRights.CanUpdate() && !_obj.State.IsInserted && _obj.DocumentRegister != null && _obj.DocumentRegister.RegistrationGroup != null && !Functions.Module.CalculateParams(e, _obj.DocumentRegister.RegistrationGroup, true, true, false, false, null)) { foreach (var property in _obj.State.Properties) { property.IsEnabled = false; } } var register = _obj.DocumentRegister; // Если в формате номера в журнале есть код подразделения, то проверять, что у всех указанных в настройке подразделений заполнены коды. if (register != null) { if (register.NumberFormatItems.Any(f => f.Element == DocumentRegisterNumberFormatItems.Element.DepartmentCode)) { var hasDepartmentsWithoutCode = _obj.Departments.Any() ? _obj.Departments.Select(x => x.Department).Any(x => x.Code == null) : Functions.DocumentRegister.Remote.HasDepartmentWithNullCode(); if (hasDepartmentsWithoutCode) { e.AddWarning(DocumentRegisters.Resources.NeedFillDepartmentCodes, _obj.Info.Actions.ShowDepartments); } } // Если в формате номера в журнале есть код НОР, то проверять, что у всех указанных в настройке НОР заполнены коды. if (register.NumberFormatItems.Any(f => f.Element == DocumentRegisterNumberFormatItems.Element.BUCode)) { var hasBusinessUnitsWithoutCode = _obj.BusinessUnits.Any() ? _obj.BusinessUnits.Select(x => x.BusinessUnit).Any(x => x.Code == null) : Functions.DocumentRegister.Remote.HasBusinessUnitWithNullCode(); if (hasBusinessUnitsWithoutCode) { e.AddWarning(DocumentRegisters.Resources.NeedFillBusinessUnitCodes, _obj.Info.Actions.ShowBusinessUnits); } } // Если в формате номера в журнале есть код вида документа, то проверять, что у всех указанных в настройке видов документа заполнены коды. if (register.NumberFormatItems.Any(f => f.Element == DocumentRegisterNumberFormatItems.Element.DocKindCode)) { var registrationSettingDocumentKinds = _obj.DocumentKinds.Any() ? _obj.DocumentKinds.Select(x => x.DocumentKind) : DocumentKinds.GetAllCached(); var documentKindsWithoutCode = registrationSettingDocumentKinds.Where(x => x.Code == null); if (documentKindsWithoutCode.Any()) { e.AddWarning(DocumentRegisters.Resources.NeedFillDocumentKindCodes, _obj.Info.Actions.ShowDocumentKinds); } } } }
public virtual void ShowDocumentKinds(Sungero.Domain.Client.ExecuteActionArgs e) { var documentKinds = DocumentKinds.GetAllCached(); documentKinds.Show(); }