-- 3.5.42 Power
-- Добавляем объединённый справочник климатических исполнений и категорий размещения по ГОСТ 15150-69

-- Добавляем недостающие категории размещения
SET IDENTITY_INSERT Справочник_категорий_размещения ON
INSERT INTO Справочник_категорий_размещения (Код_категории_размещения, Описание) VALUES (6, '1.1. В закрытых помещениях и кратковременно на открытом воздухе')
INSERT INTO Справочник_категорий_размещения (Код_категории_размещения, Описание) VALUES (7, '2.1. Внутри комплектного изделия категорий 1;1.1;2')
INSERT INTO Справочник_категорий_размещения (Код_категории_размещения, Описание) VALUES (8, '3.1. В нерегулярно отапливаемом помещении')
INSERT INTO Справочник_категорий_размещения (Код_категории_размещения, Описание) VALUES (9, '4.1. В помещении с кондиционированным воздухом')
INSERT INTO Справочник_категорий_размещения (Код_категории_размещения, Описание) VALUES (10, '4.2. В лабораторном или капитальном жилом помещении')
INSERT INTO Справочник_категорий_размещения (Код_категории_размещения, Описание) VALUES (11, '5.1. Внутри комплектного изделия категории 5')
SET IDENTITY_INSERT Справочник_категорий_размещения OFF

-- Добавляем недостающие климатические исполнения
SET IDENTITY_INSERT Справочник_климатических_исполнений ON
INSERT INTO Справочник_климатических_исполнений (Код_климатического_исполнения, Описание, Обозначение) VALUES (12, 'тёплый умеренный климат', 'ТУ')
SET IDENTITY_INSERT Справочник_климатических_исполнений OFF

GO

CREATE TABLE DictClimaticAllocations (
  ID int IDENTITY(1,1),
  ClimaticImplementationID int NULL,
  AllocationCategoryID int NULL,
  Description nvarchar(16),
  Hidden bit,
  PRIMARY KEY(ID)
)

ALTER TABLE DictClimaticAllocations
  ADD FOREIGN KEY (ClimaticImplementationID) 
    REFERENCES Справочник_климатических_исполнений

ALTER TABLE DictClimaticAllocations
  ADD FOREIGN KEY (AllocationCategoryID) 
    REFERENCES Справочник_категорий_размещения

GO

SET IDENTITY_INSERT DictClimaticAllocations ON
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (1, 1, 1, 'У1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (2, 1, 2, 'У2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (3, 1, 3, 'У3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (4, 1, 4, 'У4', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (5, 1, 5, 'У5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (6, 1, 6, 'У1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (7, 1, 7, 'У2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (8, 1, 8, 'У3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (9, 1, 9, 'У4.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (10, 1, 10, 'У4.2', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (11, 1, 11, 'У5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (12, 2, 1, 'УХЛ1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (13, 2, 2, 'УХЛ2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (14, 2, 3, 'УХЛ3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (15, 2, 4, 'УХЛ4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (16, 2, 5, 'УХЛ5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (17, 2, 6, 'УХЛ1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (18, 2, 7, 'УХЛ2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (19, 2, 8, 'УХЛ3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (20, 2, 9, 'УХЛ4.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (21, 2, 10, 'УХЛ4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (22, 2, 11, 'УХЛ5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (23, 3, 1, 'ХЛ1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (24, 3, 2, 'ХЛ2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (25, 3, 3, 'ХЛ3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (26, 3, 4, 'ХЛ4', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (27, 3, 5, 'ХЛ5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (28, 3, 6, 'ХЛ1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (29, 3, 7, 'ХЛ2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (30, 3, 8, 'ХЛ3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (31, 3, 9, 'ХЛ4.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (32, 3, 10, 'ХЛ4.2', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (33, 3, 11, 'ХЛ5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (34, 4, 1, 'Т1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (35, 4, 2, 'Т2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (36, 4, 3, 'Т3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (37, 4, 4, 'Т4', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (38, 4, 5, 'Т5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (39, 4, 6, 'Т1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (40, 4, 7, 'Т2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (41, 4, 8, 'Т3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (42, 4, 9, 'Т4.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (43, 4, 10, 'Т4.2', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (44, 4, 11, 'Т5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (45, 5, 1, 'О1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (46, 5, 2, 'О2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (47, 5, 3, 'О3', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (48, 5, 4, 'О4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (49, 5, 5, 'О5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (50, 5, 6, 'О1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (51, 5, 7, 'О2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (52, 5, 8, 'О3.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (53, 5, 9, 'О4.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (54, 5, 10, 'О4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (55, 5, 11, 'О5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (56, 6, 1, 'ТВ1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (57, 6, 2, 'ТВ2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (58, 6, 3, 'ТВ3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (59, 6, 4, 'ТВ4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (60, 6, 5, 'ТВ5', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (61, 6, 6, 'ТВ1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (62, 6, 7, 'ТВ2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (63, 6, 8, 'ТВ3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (64, 6, 9, 'ТВ4.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (65, 6, 10, 'ТВ4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (66, 6, 11, 'ТВ5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (67, 7, 1, 'ТС1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (68, 7, 2, 'ТС2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (69, 7, 3, 'ТС3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (70, 7, 4, 'ТС4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (71, 7, 5, 'ТС5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (72, 7, 6, 'ТС1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (73, 7, 7, 'ТС2.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (74, 7, 8, 'ТС3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (75, 7, 9, 'ТС4.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (76, 7, 10, 'ТС4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (77, 7, 11, 'ТС5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (78, 8, 1, 'М1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (79, 8, 2, 'М2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (80, 8, 3, 'М3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (81, 8, 4, 'М4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (82, 8, 5, 'М5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (83, 8, 6, 'М1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (84, 8, 7, 'М2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (85, 8, 8, 'М3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (86, 8, 9, 'М4.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (87, 8, 10, 'М4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (88, 8, 11, 'М5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (89, 9, 1, 'ТМ1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (90, 9, 2, 'ТМ2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (91, 9, 3, 'ТМ3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (92, 9, 4, 'ТМ4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (93, 9, 5, 'ТМ5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (94, 9, 6, 'ТМ1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (95, 9, 7, 'ТМ2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (96, 9, 8, 'ТМ3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (97, 9, 9, 'ТМ4.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (98, 9, 10, 'ТМ4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (99, 9, 11, 'ТМ5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (100, 10, 1, 'ОМ1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (101, 10, 2, 'ОМ2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (102, 10, 3, 'ОМ3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (103, 10, 4, 'ОМ4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (104, 10, 5, 'ОМ5', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (105, 10, 6, 'ОМ1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (106, 10, 7, 'ОМ2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (107, 10, 8, 'ОМ3.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (108, 10, 9, 'ОМ4.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (109, 10, 10, 'ОМ4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (110, 10, 11, 'ОМ5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (111, 11, 1, 'В1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (112, 11, 2, 'В2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (113, 11, 3, 'В3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (114, 11, 4, 'В4')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (115, 11, 5, 'В5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (116, 11, 6, 'В1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (117, 11, 7, 'В2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (118, 11, 8, 'В3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (119, 11, 9, 'В4.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (120, 11, 10, 'В4.2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (121, 11, 11, 'В5.1')

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (122, 12, 1, 'ТУ1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (123, 12, 2, 'ТУ2')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (124, 12, 3, 'ТУ3')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (125, 12, 4, 'ТУ4', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (126, 12, 5, 'ТУ5')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (127, 12, 6, 'ТУ1.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (128, 12, 7, 'ТУ2.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description) VALUES (129, 12, 8, 'ТУ3.1')
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (130, 12, 9, 'ТУ4.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (131, 12, 10, 'ТУ4.2', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (132, 12, 11, 'ТУ5.1', 1)

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (133, NULL, 1, '?1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (134, NULL, 2, '?2', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (135, NULL, 3, '?3', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (136, NULL, 4, '?4', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (137, NULL, 5, '?5', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (138, NULL, 6, '?1.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (139, NULL, 7, '?2.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (140, NULL, 8, '?3.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (141, NULL, 9, '?4.1', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (142, NULL, 10, '?4.2', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (143, NULL, 11, '?5.1', 1)

INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (144, 1, NULL, 'У?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (145, 2, NULL, 'УХЛ?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (146, 3, NULL, 'ХЛ?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (147, 4, NULL, 'Т?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (148, 5, NULL, 'О?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (149, 6, NULL, 'ТВ?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (150, 7, NULL, 'ТС?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (151, 8, NULL, 'М?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (152, 9, NULL, 'ТМ?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (153, 10, NULL, 'ОМ?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (154, 11, NULL, 'В?', 1)
INSERT INTO DictClimaticAllocations (ID, ClimaticImplementationID, AllocationCategoryID, Description, Hidden) VALUES (155, 12, NULL, 'ТУ?', 1)

SET IDENTITY_INSERT DictClimaticAllocations OFF

UPDATE Справочник_категорий_размещения SET Описание = '1. На открытом воздухе' WHERE Код_категории_размещения = 1
UPDATE Справочник_категорий_размещения SET Описание = '2. Под навесом или в помещении с открытым доступом воздуха' WHERE Код_категории_размещения = 2
UPDATE Справочник_категорий_размещения SET Описание = '3. В закрытом помещении без искусственного регулирования климатических условий' WHERE Код_категории_размещения = 3
UPDATE Справочник_категорий_размещения SET Описание = '4. В закрытом помещении с искусственно регулируемыми климатическими условиями' WHERE Код_категории_размещения = 4
UPDATE Справочник_категорий_размещения SET Описание = '5. В помещениях с повышенной влажностью' WHERE Код_категории_размещения = 5
GO

-- Добавляем ссылку на новый справочник в те места, где были отдельно климатические исполнения или категории размещения
ALTER TABLE Оборудование ADD ClimaticAllocationID int NULL
ALTER TABLE Оборудование ADD ActualAllocationID int NULL
ALTER TABLE Оборудование
  ADD FOREIGN KEY (ClimaticAllocationID)
    REFERENCES DictClimaticAllocations

ALTER TABLE Оборудование
  ADD FOREIGN KEY (ActualAllocationID)
    REFERENCES Справочник_категорий_размещения

ALTER TABLE Справочник_автотрансформаторов ADD ClimaticAllocationID int NULL
ALTER TABLE Справочник_автотрансформаторов
  ADD FOREIGN KEY (ClimaticAllocationID)
    REFERENCES DictClimaticAllocations

ALTER TABLE Справочник_двухобм_тр ADD ClimaticAllocationID int NULL
ALTER TABLE Справочник_двухобм_тр
  ADD FOREIGN KEY (ClimaticAllocationID)
    REFERENCES DictClimaticAllocations

ALTER TABLE Справочник_трехобм_тр ADD ClimaticAllocationID int NULL
ALTER TABLE Справочник_трехобм_тр
  ADD FOREIGN KEY (ClimaticAllocationID)
    REFERENCES DictClimaticAllocations

ALTER TABLE Справочник_тр_расщ_обм ADD ClimaticAllocationID int NULL
ALTER TABLE Справочник_тр_расщ_обм
  ADD FOREIGN KEY (ClimaticAllocationID)
    REFERENCES DictClimaticAllocations

ALTER TABLE Справочник_трансформаторов_напряжения ADD ClimaticAllocationID int NULL
ALTER TABLE Справочник_трансформаторов_напряжения
  ADD FOREIGN KEY (ClimaticAllocationID)
    REFERENCES DictClimaticAllocations

ALTER TABLE Справочник_трансформаторов_тока ADD ClimaticAllocationID int NULL
ALTER TABLE Справочник_трансформаторов_тока
  ADD FOREIGN KEY (ClimaticAllocationID)
    REFERENCES DictClimaticAllocations
GO
-- Добавляем информацию о человеческих названиях атрибутов
SET IDENTITY_INSERT Характеристики_полей ON
INSERT INTO Характеристики_полей(Код_характеристики,Имя_таблицы,Имя_поля,Используемое_поле,Используемая_таблица,Обозначение,Описание,Единица_измерения)
        VALUES (580, '<any>', 'ClimaticAllocationID', 'Description','DictClimaticAllocations','Климатическое исполнение и категория размещения',NULL,NULL)
INSERT INTO Характеристики_полей(Код_характеристики,Имя_таблицы,Имя_поля,Используемое_поле,Используемая_таблица,Обозначение,Описание,Единица_измерения)
        VALUES (581, 'DictClimaticAllocations', 'ClimaticImplementationID', 'Описание', 'Справочник_климатических_исполнений', 'Климатическое исполнение', NULL, NULL)
INSERT INTO Характеристики_полей(Код_характеристики,Имя_таблицы,Имя_поля,Используемое_поле,Используемая_таблица,Обозначение,Описание,Единица_измерения)
        VALUES (582, 'DictClimaticAllocations', 'AllocationCategoryID', 'Описание', 'Справочник_категорий_размещения', 'Категория размещения', NULL, NULL)
SET IDENTITY_INSERT Характеристики_полей OFF
