
using System.Collections.Generic;
using System.Data;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System;

namespace RestApi
{
    [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single, ConcurrencyMode = ConcurrencyMode.Single, IncludeExceptionDetailInFaults = true)]

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class RollMillGetService : IRollMillDataGet
    {
        private RollMillData roll_mill_data = new RollMillData();

        public RollMillEnergyTrend rmEnergyTrend { set; get; }

        public CZState czState{set; get;}

        public RollMillEnergyTrend EnergyTrend()
        {
            return rmEnergyTrend;
        }

        public RollMillData Roll_mill_data
        {
            get { return roll_mill_data; }
            set { roll_mill_data = value; }
        }

        public RollMillGetService()
        {
            BoxData bd = new BoxData
            {
                names = new string[] { "中频振动能量", "高频振动能量", "低频振动能量", "机架轧制速度" },
                values = new double[] { 0.001, 0, 0, 0 },
                levels = new int[] { 0, 0, 0, 0 },
                level = 0,
                alarmValues = new double[] { 0, 0, 0, 10000 },
                faultValues = new double[] { 0, 0, 0, 20000 }
            };
            roll_mill_data.F1 = bd;
            roll_mill_data.F2 = bd;
            roll_mill_data.F3 = bd;
            roll_mill_data.F4 = bd;
            roll_mill_data.F5 = bd;
            roll_mill_data.F6 = bd;
            rmEnergyTrend = new RollMillEnergyTrend();
        }

        public CZState CZStateGet()
        {
            return czState;
        }
        public BoxData RollMillByName(string name)
        {
            switch (name)
            {
                case "F1":
                    return roll_mill_data.F1;

                case "F2":
                    return roll_mill_data.F2;

                case "F3":
                    return roll_mill_data.F3;

                case "F4":
                    return roll_mill_data.F4;

                case "F5":
                    return roll_mill_data.F5;
                case "F6":
                    return roll_mill_data.F6;

                default:
                    return roll_mill_data.F1;

            }
        }
        public RollMillData RollMill()
        {
            return roll_mill_data;
        }

        public AlarmInfo RollMillAF()
        {
            return roll_mill_data.AF;
        }
    }
}
