コード例 #1
0
        private List <ContainerMaterialsViewModel> GetContainerMaterialsViewModels(Static.ContainerItem containerItem)
        {
            var recipeMaterials = new List <ContainerMaterialsViewModel>();
            var containers      = ContainersReader.ListContainers();
            var container       = containers.FirstOrDefault(x => x.Id == Static.IdСontainerDictionary[containerItem]);

            if (container.ContainerType?.MaterialType != null)
            {
                var materialTypeId = container.ContainerType.MaterialType.Id;
                var materials      =
                    new ObservableCollection <ApiMaterial>(
                        MaterialsReader.ListMaterialsByMaterialTypeId(materialTypeId));
                materials.Insert(0, new ApiMaterial {
                    Name = "Нет материала"
                });
                var comboboxViewModel = new ContainerMaterialsViewModel()
                {
                    Container   = container,
                    Materials   = materials,
                    SelMaterial = materials.FirstOrDefault(x => container.CurrentMaterial != null && x.Id == container.CurrentMaterial.Id)
                                  ?? materials.First(),
                };
                recipeMaterials.Add(comboboxViewModel);
            }

            return(recipeMaterials);
        }
コード例 #2
0
        public WindowMatchingMaterials(Static.ContainerItem containerItem)
        {
            InitializeComponent();

            var matchingMaterialsViewModel = new MatchingMaterialsViewModel(containerItem);

            DataContext = matchingMaterialsViewModel;
        }
コード例 #3
0
        public ContainerSettingsViewModel(OpcServer.OpcList opcName, Static.ContainerItem containerSettingsItem)
        {
            _opcName       = opcName;
            _containerItem = containerSettingsItem;

            IsCementBunker = _containerItem == Static.ContainerItem.Silo1 || _containerItem == Static.ContainerItem.Silo2;
            _numSilo       = _containerItem == Static.ContainerItem.Silo1 ? 1 : 2;

            NameContainer = "Настройки массы емкости. " + Static.СontainerNameDictionary[_containerItem] + " (" + Static.СontainerMaterialDictionary[_containerItem] + ")";

            _digit = containerSettingsItem == Static.ContainerItem.Additive1 ? 2 : 1;
            Subscribe();
        }
コード例 #4
0
 private void UpdateContainerMaterials(Static.ContainerItem containerItem)
 {
     ContainerMaterialsViewModels = new ObservableCollection <ContainerMaterialsViewModel>(GetContainerMaterialsViewModels(containerItem));
 }
コード例 #5
0
 public MatchingMaterialsViewModel(Static.ContainerItem containerItem)
 {
     UpdateContainerMaterials(containerItem);
 }
コード例 #6
0
        public DosingSettingsViewModel(OpcServer.OpcList opcName, DosingSettingType typeMaterial, Static.ContainerItem containerItem)
        {
            _opcName       = opcName;
            _containerItem = containerItem;
            _typeMaterial  = typeMaterial;

            switch (typeMaterial)
            {
            case DosingSettingType.Cement:
                NameWindow           = "Настройки дозирования цемента.\n";
                IsCement             = true;
                WorkMode             = new WorkMode[1];
                WorkMode[0]          = new WorkMode(opcName);
                WorkMode[0].NameGate = "Выгрузка цемента";
                WorkMode[0].TagGate  = "V_2";
                switch (_containerItem)
                {
                case Static.ContainerItem.Silo1:
                    _tagWeight     = "Cement_Silo1";
                    _tagPreciseDos = "Cement_1";
                    break;

                case Static.ContainerItem.Silo2:
                    _tagWeight     = "Cement_Silo2";
                    _tagPreciseDos = "Cement_2";
                    break;
                }
                WorkMode[0].HeaderGate = WorkMode[0].NameGate;
                break;

            case DosingSettingType.Water:
                NameWindow             = "Настройки дозирования воды.\n";
                IsWaterOrAdditive      = true;
                WorkMode               = new WorkMode[2];
                WorkMode[0]            = new WorkMode(opcName);
                WorkMode[1]            = new WorkMode(opcName);
                WorkMode[0].NameGate   = "Дозирование воды";
                WorkMode[0].TagGate    = "V_4";
                WorkMode[1].NameGate   = "Выгрузка воды";
                WorkMode[1].TagGate    = "V_3";
                _tagWeight             = _tagPreciseDos = "Water";
                WorkMode[0].HeaderGate = WorkMode[0].NameGate;
                WorkMode[1].HeaderGate = WorkMode[1].NameGate;
                break;

            case DosingSettingType.Additive:
                NameWindow        = "Настройки дозирования химической добавки.\n";
                IsWaterOrAdditive = true;
                WorkMode          = new WorkMode[2];
                WorkMode[0]       = new WorkMode(opcName);
                WorkMode[1]       = new WorkMode(opcName);
                switch (_containerItem)
                {
                case Static.ContainerItem.Additive1:
                    WorkMode[0].NameGate = "Источник хим. добавки №1";
                    WorkMode[0].TagGate  = "V_6";
                    _tagWeight           = "Additive_Tank1";
                    _tagPreciseDos       = "Additive_1";
                    break;

                case Static.ContainerItem.Additive2:
                    WorkMode[0].NameGate = "Источник хим. добавки №2";
                    WorkMode[0].TagGate  = "V_7";
                    _tagWeight           = "Additive_Tank2";
                    _tagPreciseDos       = "Additive_2";
                    break;
                }
                WorkMode[1].NameGate   = "Выгрузка хим. добавки";
                WorkMode[1].TagGate    = "V_5";
                WorkMode[0].HeaderGate = WorkMode[0].NameGate;
                WorkMode[1].HeaderGate = WorkMode[1].NameGate;
                break;

            case DosingSettingType.Inert:
                NameWindow    = "Настройки дозирования инертного материала.\n";
                IsInertBunker = true;
                WorkMode      = new WorkMode[3];
                WorkMode[0]   = new WorkMode(opcName, true);
                WorkMode[1]   = new WorkMode(opcName, true);
                WorkMode[2]   = new WorkMode(opcName, true);
                switch (_containerItem)
                {
                case Static.ContainerItem.Bunker1:
                    WorkMode[0].NameGate = "V-9-1";
                    WorkMode[1].NameGate = "V-9-2";
                    WorkMode[2].NameGate = "Обе";
                    WorkMode[0].TagGate  = "V_9_1";
                    WorkMode[1].TagGate  = "V_9_2";
                    WorkMode[2].TagGate  = "V_9_Both";
                    _tagWeight           = "Inert_Bunker1";
                    _tagPreciseDos       = "Inert_1";
                    break;

                case Static.ContainerItem.Bunker2:
                    WorkMode[0].NameGate = "V-10-1";
                    WorkMode[1].NameGate = "V-10-2";
                    WorkMode[2].NameGate = "Обе";
                    WorkMode[0].TagGate  = "V_10_1";
                    WorkMode[1].TagGate  = "V_10_2";
                    WorkMode[2].TagGate  = "V_10_Both";
                    _tagWeight           = "Inert_Bunker2";
                    _tagPreciseDos       = "Inert_2";
                    break;

                case Static.ContainerItem.Bunker3:
                    WorkMode[0].NameGate = "V-11-1";
                    WorkMode[1].NameGate = "V-11-2";
                    WorkMode[2].NameGate = "Обе";
                    WorkMode[0].TagGate  = "V_11_1";
                    WorkMode[1].TagGate  = "V_11_2";
                    WorkMode[2].TagGate  = "V_11_Both";
                    _tagWeight           = "Inert_Bunker3";
                    _tagPreciseDos       = "Inert_3";
                    break;

                case Static.ContainerItem.Bunker4:
                    WorkMode[0].NameGate = "V-12-1";
                    WorkMode[1].NameGate = "V-12-2";
                    WorkMode[2].NameGate = "Обе";
                    WorkMode[0].TagGate  = "V_12_1";
                    WorkMode[1].TagGate  = "V_12_2";
                    WorkMode[2].TagGate  = "V_12_Both";
                    _tagWeight           = "Inert_Bunker4";
                    _tagPreciseDos       = "Inert_4";
                    break;
                }
                WorkMode[0].HeaderGate = "Работа задвижкой " + WorkMode[0].NameGate;
                WorkMode[1].HeaderGate = "Работа задвижкой " + WorkMode[1].NameGate;
                WorkMode[2].HeaderGate = "Работа задвижками " + WorkMode[0].NameGate + " и " + WorkMode[1].NameGate;
                break;
            }

            _digit = _containerItem == Static.ContainerItem.Additive1 ? 2 : 1;

            NameWindow += Static.СontainerNameDictionary[_containerItem] + " (" + Static.СontainerMaterialDictionary[_containerItem] + ")";

            Subscribe();
        }