using CFX.Structures;
using CFX.Structures.CommonUseEquipment;
using CFX.Structures.SolderReflow;
using Sln.Iot.Model.Entity;

namespace Sln.Iot.CFX.CFXBusiness
{
    public class CFXUnitProcessedDataGet
    {
        private static readonly Lazy<CFXUnitProcessedDataGet> lazy = new Lazy<CFXUnitProcessedDataGet>(() => new CFXUnitProcessedDataGet());

        public static CFXUnitProcessedDataGet Instance
        {
            get
            {
                return lazy.Value;
            }
        }
        
        /// <summary>
        /// 真空点胶数据
        /// </summary>
        /// <returns></returns>
        public CommonProcessData ProcessDataGetVacuum(UnitsProcessVacuumEntity entity)
        {
            //entity = new UnitsProcessVacuumEntity()
            //{
            //    GlueAmountSetValue1 = 123.4f,
            //    GluePushSpeedSetValue1 = 10.1f,
            //    BarrelA1TempActValue1 = 60,
            //    BarrelA2TempActValue1 = 60,
            //    BarrelB1TempActValue1 = 60,
            //    BarrelB2TempActValue1 = 60,
            //    PumpAPressureActValue1 = 3.5f,
            //    PumpBPressureActValue1 = 3.2f,
            //    VacuumDegreeActValue1 = 3000.4f,
            //    PressureHoldTimeSetValue1 = 100,
            //    GlueAmountSetValue2 = 123.4f,
            //    GluePushSpeedSetValue2 = 10.1f,
            //    BarrelA1TempActValue2 = 60,
            //    BarrelA2TempActValue2 = 60,
            //    BarrelB1TempActValue2 = 60,
            //    BarrelB2TempActValue2 = 60,
            //    PumpAPressureActValue2 = 3.5f,
            //    PumpBPressureActValue2 = 3.2f,
            //    VacuumDegreeActValue2 = 3000.4f,
            //    PressureHoldTimeSetValue2 = 100,
            //};
            
            CommonProcessData processData = new CommonProcessData()
            {
                ZoneData = new List<CommonUseZoneData>
                {
                    new CommonUseZoneData()
                    {
                        Setpoints = new List<CommonUseSetpoint>()
                        {
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GluePushSpeedSetValue,
                                SetpointName = "GluePushSpeedSetValue"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue1,
                                SetpointName = "GlueAmountSetValue1"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue2,
                                SetpointName = "GlueAmountSetValue2"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue3,
                                SetpointName = "GlueAmountSetValue3"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue4,
                                SetpointName = "GlueAmountSetValue4"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue5,
                                SetpointName = "GlueAmountSetValue5"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue6,
                                SetpointName = "GlueAmountSetValue6"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue7,
                                SetpointName = "GlueAmountSetValue7"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue8,
                                SetpointName = "GlueAmountSetValue8"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue9,
                                SetpointName = "GlueAmountSetValue9"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue10,
                                SetpointName = "GlueAmountSetValue10"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.VacuumDegreeSetValue,
                                SetpointName = "VacuumDegreeSetValue"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.PressureHoldTimeSetValue,
                                SetpointName = "PressureHoldTimeSetValue"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.VacuumIsUseSetValue,
                                SetpointName = "VacuumIsUseSetValue"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.TotalGlueAmountSetValue,
                                SetpointName = "TotalGlueAmountSetValue"
                            },
                        },
                        Readings = new List<CommonUseReading>()
                        {
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PumpAPressureActValue,
                                ReadingName = "PumpAPressureActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PumpBPressureActValue,
                                ReadingName = "PumpBPressureActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.VacuumDegreeActValue,
                                ReadingName = "VacuumDegreeActValue",
                            }
                        },
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone1",
                            StageSequence = 1,
                            StageName = "Vacuum"
                        },
                    }
                }
            };

            return processData;
        }

        /// <summary>
        /// 隧道烤箱数据
        /// </summary>
        /// <returns></returns>
        public CommonProcessData ProcessDataGetOven(UnitsProcessOvenEntity entity)
        {
            //entity = new UnitsProcessOvenEntity()
            //{
            //    PreheatOvenTempActValue = 800,
            //    PreCureOven1TempActValue = 800,
            //    PreCureOven2TempActValue = 800,
            //    PreCureOven3TempActValue = 800,
            //    PreCureOven4TempActValue = 800,
            //    CureOven1TempActValue = 800,
            //    CureOven2TempActValue = 800,
            //    CureOven3TempActValue = 800,
            //    CureOven4TempActValue = 800,
            //};

            CommonProcessData processData = new CommonProcessData()
            {
                ZoneData = new List<CommonUseZoneData>
                {
                    new CommonUseZoneData()
                    {
                        Setpoints = new List<CommonUseSetpoint>()
                        {
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.CureOven1SetValue,
                                SetpointName = "CureOven1SetValue"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.CureOven2SetValue,
                                SetpointName = "CureOven2SetValue"
                            },
                        },
                        Readings = new List<CommonUseReading>()
                        {
                            new CommonUseReading()
                            {
                                ReadingValue = entity.CureOven1ActValue,
                                ReadingName = "CureOven1ActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.CureOven2ActValue,
                                ReadingName = "CureOven2ActValue",
                            }
                        },
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone1",
                            StageSequence = 1,
                            StageName = "Oven"

                        },
                    },
                    
                }
            };

            return processData;
        }
    }
}
