static void Main(string[] args)
        {
            // Authorized client.
            var dpaClient = Examples.Login("login", "password", "http://localhost:6216");

            // Equipment list.
            var equipments = Examples.GetEquipments(dpaClient);

            // Downtime List.
            var downtimes = Examples.GetDowntimes(dpaClient, equipments.First().Id, false, FilterPeriodType.LastNDays);

            // Machine Status List.
            var machinesStates = Examples.GetMachineStatus(dpaClient);

            // List of programs executed on equipments.
            var processingProgramRecords = Examples.GetProcessingProgramRecord(dpaClient);

            // List of orders.
            var orders = Examples.GetOrders(dpaClient);

            // List of completed orders.
            var completedOrders = Examples.GetCompletedOrders(dpaClient);

            // List of completed orders for last month and for specific equipment.
            var completedOrdersForLastMonth = Examples.GetCompletedOrdersForLastMonth(dpaClient);
        }
Пример #2
0
        public long GetIndicatorByName(string equipmentName, string indicatorName)
        {
            var resultObject = GetIndicatorList(equipmentName);

            var indicator = resultObject.FirstOrDefault(ind => ind.Name == indicatorName);

            if (indicator == null)
            {
                throw Examples.NotFoundException("Indicator", indicatorName);
            }
            return(indicator.Id);
        }
        public void AddAwaitingForTransportTicket(string equipmentName)
        {
            var equipmentId = GetEquipmentByName(equipmentName);

            if (!TryGetTicketByName(AWAITING_FOR_TRANSPORT_TICKET_NAME_RUS, out long ticketId))
            {
                if (!TryGetTicketByName(AWAITING_FOR_TRANSPORT_TICKET_NAME_ENG, out ticketId))
                {
                    throw Examples.NotFoundException("Ticket", AWAITING_FOR_TRANSPORT_TICKET_NAME_RUS);
                }
            }

            AddTicket(equipmentId, ticketId);
        }
Пример #4
0
        static void Main(string[] args)
        {
            // Authorized client.
            var dpaClient = Examples.Login(login: "******", password: "******", serverUrlAddress: "http://localhost:6216");

            // Equipment list.
            var equipments = Examples.GetEquipments(dpaClient);

            ViewResult("Список оборудования", equipments);

            // Downtime List.
            var downtimes = Examples.GetDowntimes(dpaClient, equipments.First().Id, false, FilterPeriodType.LastNDays);

            ViewResult("Список простоев", downtimes);

            // Machine Status List.
            var machinesStates = Examples.GetMachineStatus(dpaClient);

            ViewResult("Список состояний станков", machinesStates);

            // List of programs executed on equipments.
            var processingProgramRecords = Examples.GetProcessingProgramRecord(dpaClient);

            ViewResult("Список программ выполняемых на станке", processingProgramRecords);

            // List of orders.
            var orders = Examples.GetOrders(dpaClient);

            ViewResult("Список заданий", orders);

            // List of completed orders.
            var completedOrders = Examples.GetCompletedOrders(dpaClient);

            ViewResult("Список выполненных заданий", completedOrders);

            // List of completed orders for last month and for specific equipment.
            var completedOrdersForLastMonth = Examples.GetCompletedOrdersForLastMonthByEquipment(dpaClient, "Equipment 1");

            ViewResult("Список выполненных заданий за последний месяц", completedOrdersForLastMonth);

            // Adds ticket for dispatcher
            if (equipments.Any())
            {
                Examples.AddTicket(dpaClient, equipments.FirstOrDefault().Name);
            }

            dpaClient.SetPreviousOperationCompleted("1000016132436", true);

            Console.ReadKey();
        }
Пример #5
0
        public IdNameContainer[] GetIndicatorList(string equipmentName)
        {
            var url = "/api/dashboard/getIndicators";

            var equipmentId = Examples.GetEquipmentIdByName(dpaClient, equipmentName);

            var equipmentIdListParam = new List <long>()
            {
                equipmentId
            };
            var postParams = JsonConvert.SerializeObject(equipmentIdListParam);
            var postResult = dpaClient.Post(url, postParams);

            if (string.IsNullOrEmpty(postResult))
            {
                throw new Exception("No one indicator found");
            }

            var resultObject = JsonConvert.DeserializeObject <IdNameContainer[]>(postResult);

            return(resultObject);
        }