Автоматизация заведения документов в Биллинге
Решаемые проблемы
- Для заведения документа нужен разработчик
- Дорого
- Неудобно
- Много хардкода
- Устаревшая логика

Хардкоды

Unsearchable types
CaKonturAdditionalContract
CaKonturSoftwareLicenseContractToSpecification
CaKonturSpecification
CaSertumProSpecification
CaSertumProSublicenseZakupki
DiadocConditionsOfRemoteUse
DiadocContractOld
DiadocSpecificationPostPaid
DiadocSpecificationPostPaidWithCloud
DiadocSpecificationPrePaid
DiadocSpecificationPrePaidWithCloud
EdiLicenseeUnitList
EdiSpecification
FmsSpecification
KembConditionsOfRemoteUse
KembImportedAdditionalContract
KembImportedContract
KembImportedSpecification
KembImportedSpecificationWithCloud
KembSpecification
KembSpecificationWithCloud
LicenseCryptoArm
LicenseCryptoPro
LicenseCryptoProLimitedByUseArea
OfdApiKonturNTTSpecification
OfdKonturNTTContractCommercial
OfdPrepaidInvoice
PaymentOrder
PiiSpecification
PrepaidInvoice
Procuration
ProductCaSpecificationPrePaid
Receipt
Unknown
ZakupkiSpecificationЭти документы не индексируются поиском ООРВ и партнерки
SearchableDocumentInfoList
ООРВ: Поиск идет среди документов клиентов, к которым имеет доступ менеджер партнера.
Партнерка: Поиск идет среди документов всех клиентов.
Unsearchable types
Решение: показывать все документы, выпилить этот костыль.
Риск: Возможно есть шаманская логика в этом всем, и оно действительно надо.
Еще хардкоды
Решение:
1. Перенести сущности DocumentInfoType (и связанные с ней) в банку
2. Выпилить старые схемы/списки
Много конвертеров, справочников, заполняемых вручную:
DocumentInfoToContractTypeDictionary(Contragent), CertificateContractTypeConverter...
Выпиливание DocumentInfoType
| Id | ContragentName | Certificate ContractType |
IsSearchable |
|---|---|---|---|
Выпиливание CertificateContractTypeConverter
?Выпиливание SearchableDocumentInfoList
(возможно просто выпилим без заведения столбца)
Выпиливание DocumentInfoToContractTypeDictionary
Выпиливаем костыль
CommonDateDocumentLinkRefference
| Id (DocInfoTypeId) | GroupId |
|---|---|
Сейчас документы, у которых должна быть одинаковая дата, сгруппированы в коллекцию-хардкод, после фиксов поиск сгруппированых документов будет происходить через банку.
Параметры печати факсимиле, бланков
PrintAvailabilitySettingsChecker
Проблемы:
1. Много разных структур
2. Не очевидные условия
3. Наличие нестандартных случаев
private static readonly HashSet<string> dontPrintOnBlankProductIds = new HashSet<string>
{
Product.KmService,
Product.Ofd,
Product.Market,
Product.OfdApi,
Product.BidsSupportServices,
Product.Reestro,
};
private static readonly Guid[] facsimileDocuments =
{
DocumentInfoType.Act,
DocumentInfoType.Bill,
DocumentInfoType.Offer,
};
private static readonly Dictionary<string, Guid[]> specialFacsimileDocumentsByProduct =
new Dictionary<string, Guid[]>
{
{
Product.Ofd, new[]
{
DocumentInfoType.Bill,
DocumentInfoType.Offer,
DocumentInfoType.OfdBill,
}
},
{
Product.Market, new[]
{
DocumentInfoType.Bill,
DocumentInfoType.Offer,
DocumentInfoType.MarketAct
}
},
... public PrintAvailabilitySettings Check(Guid documentInfoId, string productId)
{
return new PrintAvailabilitySettings
{
CanPrintOnBlank = CanPrintOnBlank(productId),
CanPrintWithFacsimile = CanPrintWithFacsimile(documentInfoId, productId)
};
}
private static bool CanPrintWithFacsimile(Guid documentInfoId, string productId)
{
if (specialFacsimileDocumentsByProduct.SafeGet(productId)?.Contains(documentInfoId) ?? false)
{
return true;
}
return CanPrintOnBlank(productId) && facsimileDocuments.Contains(documentInfoId);
}
private static bool CanPrintOnBlank([NotNull] string productId)
{
return !dontPrintOnBlankProductIds.Contains(productId);
}Rules & Conditions
Проблема обсуждалась на одной из прошлых встреч, договорились до решения переноса правил и условий в древовидную структуру в БД.
Ждем ваших предложений)
Автоматизация заведения документов
By dubovtsev
Автоматизация заведения документов
- 201