Ejemplo n.º 1
0
        public async ValueTask <Srv.Dto.S7.List.GridView.S7Tag> S7TagAsync(CallContext context = default)
        {
            _logger.LogTrace("Query: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);

            var repository = await _s7TagRepository.GetAllS7TagAsync();

            var tagItems = repository.ToList().Select(
                tag => _mapper.Map <Srv.Dto.S7.S7Tag>(tag)
                ).ToList();

            var commonAnalogDigitalDns = await _queryListKeyValue.AnalogDigitalSignalAsync();

            var commonTagGroupDns = await _queryListKeyValue.TagGroupIdAsync(context);

            var commonInOutDns = await _queryListKeyValue.InputOutputAsync(context);

            var s7ConnectionDns = await _queryS7ListKeyValue.S7ConnectionIdAsync(context);

            var areaDns = await _queryS7ListKeyValue.AreaIdAsync(context);

            var wordLenDns = await _queryS7ListKeyValue.WordLenIdAsync(context);

            var bitOfByteDns = await _queryListKeyValue.BitOfByteAsync(context);

            var output = new Srv.Dto.S7.List.GridView.S7Tag(
                tagItems,
                commonAnalogDigitalDns.List, commonTagGroupDns.List,
                commonInOutDns.List, s7ConnectionDns.List, areaDns.List,
                wordLenDns.List, bitOfByteDns.List);

            return(output);
        }
Ejemplo n.º 2
0
        public async ValueTask <Srv.Dto.S7.Model.S7Tag> GetS7TagModelByIdAsync(IdObject idObject, CallContext context = default)
        {
            _logger.LogTrace("Query Behavior: " + GetType().FullName + "." + System.Reflection.MethodBase.GetCurrentMethod()?.Name);
            Srv.Dto.S7.S7Tag tag;
            if (idObject.Id.Equals(Guid.Empty))
            {
                tag = new S7Tag();
            }
            else
            {
                tag = await _query.GetS7TagByIdAsync(idObject, context);
            }

            var automationTypeId = await _queryKeyValue.AutomationTypeIdAsync(context);

            var analogDigitalSignal = await _queryKeyValue.AnalogDigitalSignalAsync(context);

            var tagGroupId = await _queryKeyValue.TagGroupIdAsync(context);

            var inputOutput = await _queryKeyValue.InputOutputAsync(context);

            var connectionId = await _queryKeyValue.ConnectionIdAsync(context);

            var areaId = await _queryS7KeyValue.AreaIdAsync(context);

            var wordLenId = await _queryS7KeyValue.WordLenIdAsync(context);

            var bitOfByte = await _queryKeyValue.BitOfByteAsync(context);

            return(new Srv.Dto.S7.Model.S7Tag(
                       tag, automationTypeId.List, analogDigitalSignal.List,
                       tagGroupId.List, inputOutput.List, connectionId.List,
                       areaId.List, wordLenId.List, bitOfByte.List));
        }