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 ProcessDataGet1(UnitsProcess1Entity entity)
        {
            //entity = new UnitsProcess1Entity()
            //{
            //    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.GlueAmountSetValue1,
                                SetpointName = "GlueAmountSetValue1"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GluePushSpeedSetValue1,
                                SetpointName = "GluePushSpeedSetValue1"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.PressureHoldTimeSetValue1,
                                SetpointName = "PressureHoldTimeSetValue1"
                            },
                        },
                        Readings = new List<CommonUseReading>()
                        {
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelA1TempActValue1,
                                ReadingName = "BarrelA1TempActValue1",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelA2TempActValue1,
                                ReadingName = "BarrelA2TempActValue1",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelB1TempActValue1,
                                ReadingName = "BarrelB1TempActValue1",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelB2TempActValue1,
                                ReadingName = "BarrelB2TempActValue1",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PumpAPressureActValue1,
                                ReadingName = "PumpAPressureActValue1",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PumpBPressureActValue1,
                                ReadingName = "PumpBPressureActValue1",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.VacuumDegreeActValue1,
                                ReadingName = "VacuumDegreeActValue1",
                            },

                        },
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone1",
                            StageSequence = 1,
                            StageName = "VacuumInjection1"

                        },
                    },
                    new CommonUseZoneData()
                    {
                        Setpoints = new List<CommonUseSetpoint>()
                        {
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GlueAmountSetValue2,
                                SetpointName = "GlueAmountSetValue2"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.GluePushSpeedSetValue2,
                                SetpointName = "GluePushSpeedSetValue2"
                            },
                            new CommonUseSetpoint()
                            {
                                Setpoint = entity.PressureHoldTimeSetValue2,
                                SetpointName = "PressureHoldTimeSetValue2"
                            },
                        },
                        Readings = new List<CommonUseReading>()
                        {
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelA1TempActValue2,
                                ReadingName = "BarrelA1TempActValue2",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelA2TempActValue2,
                                ReadingName = "BarrelA2TempActValue2",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelB1TempActValue2,
                                ReadingName = "BarrelB1TempActValue2",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.BarrelB2TempActValue2,
                                ReadingName = "BarrelB2TempActValue2",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PumpAPressureActValue2,
                                ReadingName = "PumpAPressureActValue2",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PumpBPressureActValue2,
                                ReadingName = "PumpBPressureActValue2",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.VacuumDegreeActValue2,
                                ReadingName = "VacuumDegreeActValue2",
                            },
                        },
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone2",
                            StageSequence = 2,
                            StageName = "VacuumInjection2"
                        },
                    }
                }
            };

            return processData;
        }

        /// <summary>
        /// 升降回流数据
        /// </summary>
        /// <returns></returns>
        public CommonProcessData ProcessDataGet2()
        {
            CommonProcessData processData = new CommonProcessData()
            {
                ZoneData = new List<CommonUseZoneData>
                {
                    new CommonUseZoneData()
                    {
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone1",
                            StageSequence = 1,
                            StageName = "Conveyor1"

                        },
                    },
                    new CommonUseZoneData()
                    {
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone2",
                            StageSequence = 2,
                            StageName = "Conveyor2"
                        },
                    }
                }
            };

            return processData;
        }

        /// <summary>
        /// 隧道烤箱数据
        /// </summary>
        /// <returns></returns>
        public CommonProcessData ProcessDataGet3(UnitsProcess3Entity entity)
        {
            //entity = new UnitsProcess3Entity()
            //{
            //    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()
                    {
                        Readings = new List<CommonUseReading>()
                        {
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PreheatOvenTempActValue,
                                ReadingName = "PreheatOvenTempActValue",
                            }
                        },
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone1",
                            StageSequence = 1,
                            StageName = "PreHeatOvem"

                        },
                    },
                    new CommonUseZoneData()
                    {
                        Readings = new List<CommonUseReading>()
                        {
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PreCureOven1TempActValue,
                                ReadingName = "PreCureOven1TempActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PreCureOven2TempActValue,
                                ReadingName = "PreCureOven2TempActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PreCureOven3TempActValue,
                                ReadingName = "PreCureOven3TempActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.PreCureOven4TempActValue,
                                ReadingName = "PreCureOven4TempActValue",
                            }
                        },
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone2",
                            StageSequence = 2,
                            StageName = "PreCureOven"
                        },
                    },
                    new CommonUseZoneData()
                    {
                        Readings = new List<CommonUseReading>()
                        {
                            new CommonUseReading()
                            {
                                ReadingValue = entity.CureOven1TempActValue,
                                ReadingName = "CureOven1ActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.CureOven2TempActValue,
                                ReadingName = "CureOven2ActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.CureOven3TempActValue,
                                ReadingName = "CureOven3ActValue",
                            },
                            new CommonUseReading()
                            {
                                ReadingValue = entity.CureOven4TempActValue,
                                ReadingName = "CureOven4ActValue",
                            }
                        },
                        Zone = new CommonUseZone()
                        {
                            ZoneName = "Zone3",
                            StageSequence = 3,
                            StageName = "CureOven"
                        },
                    }
                }
            };

            return processData;
        }
    }
}
