tangxu
2022-10-08 6b437da7145139fda9cbff0acaa5b8e2295d11cd
Application/IStation.Application.Eta/dispatch_analy/dto/Dto.cs
@@ -11,7 +11,7 @@
    public class CalcBySimple_Request
    {
        /// <summary>
        ///
        /// 机泵运行状态
        /// </summary>
        public class RunStatus
        {
@@ -24,8 +24,19 @@
            /// </summary>
            public int Status { get; set; } = -1;
        }
        /// <summary>
        /// 
        /// </summary>
        public long CorpID { get; set; }
        /// <summary>
        ///
        /// </summary>
        public long StationID { get; set; }
        /// <summary>
        /// 管路参数
        /// </summary>
        public class PipeParas 
        {
@@ -48,7 +59,7 @@
        }
        /// <summary>
        ///
        /// 阀门参数
        /// </summary>
        public class ValveParas
        {
@@ -61,32 +72,24 @@
            /// </summary>
            public int Status { get; set; }
        }
        /// <summary>
        ///
        /// </summary>
        public long CorpID { get; set; }
        /// <summary>
        ///
        /// </summary>
        public long StationID { get; set; }
        /// <summary>
        /// 水位参数 
        /// </summary>
        public List<double> WaterLevelList { get; set; }
        /// <summary>
        ///
        /// 管路参数
        /// </summary>
        public List<PipeParas> PipeList { get; set; }
        /// <summary>
        ///
        /// 阀门参数
        /// </summary>
        public List<ValveParas> ValveList { get; set; }
        /// <summary>
        ///
        /// 机泵运行参数
        /// </summary>
        public List<RunStatus> RunStatusList { get; set; }
@@ -101,7 +104,12 @@
        public int PressValueType { get; set; }
        /// <summary>
        /// /
        /// 能效分析记录
        /// </summary>
        public StationEtaAnaRecord EtaAnaRecord { get; set; }
        /// <summary>
        /// 构建成复合参数
        /// </summary>
        /// <param name="error_info"></param>
        /// <returns></returns>
@@ -113,20 +121,26 @@
            complex_request_paras.CorpID = this.CorpID;
            complex_request_paras.StationID = this.StationID;
            if(WaterLevelList != null && WaterLevelList.Count > 0)
            {
                complex_request_paras.WaterLevelPara = new List<Calculation.DispatchAna.Model.WaterLevelPara>();
                foreach(var wl in WaterLevelList)
                {
                    complex_request_paras.WaterLevelPara.Add(new Calculation.DispatchAna.Model.WaterLevelPara(wl));
                }
            }
            else if (this.PressValueType == 1)
            {//   1:表示扬程
            if (this.PressValueType == 1)
            {//1:表示扬程
                complex_request_paras.PressValueType = Calculation.DispatchAna.Model.RequestParasComplex.ePressValueType.扬程;
                complex_request_paras.WaterLevelPara = new List<Calculation.DispatchAna.Model.WaterLevelPara>();
                complex_request_paras.WaterLevelPara.Add(new Calculation.DispatchAna.Model.WaterLevelPara(0));
            }
            else
            {//压力
                complex_request_paras.PressValueType = Calculation.DispatchAna.Model.RequestParasComplex.ePressValueType.压力;
                if (WaterLevelList != null && WaterLevelList.Count > 0)
                {
                    complex_request_paras.WaterLevelPara = new List<Calculation.DispatchAna.Model.WaterLevelPara>();
                    foreach (var wl in WaterLevelList)
                    {
                        complex_request_paras.WaterLevelPara.Add(new Calculation.DispatchAna.Model.WaterLevelPara(wl));
                    }
                }
            }
            if (this.PipeList != null&& this.PipeList.Count > 0)
            {
@@ -134,16 +148,8 @@
                foreach (var pipe in this.PipeList)
                {
                    var pipe_model = new Calculation.DispatchAna.Model.OutletPipePara();
                    pipe_model.InitialFlowInfo(pipe.TargetFlow, pipe.TargetFlowMinQ , pipe.TargetFlowMaxQ);
                    if(this.PressValueType == 0)
                    {// 0:表示压力
                        pipe_model.TargetPress = pipe.TargetPress;
                    }
                    if (this.PressValueType == 1)
                    {//   1:表示扬程
                        pipe_model.TargetPress = pipe.TargetPress / 102;
                    }
                    pipe_model.InitialFlowInfo(pipe.TargetFlow, pipe.TargetFlowMinQ, pipe.TargetFlowMaxQ);
                    pipe_model.TargetPress = pipe.TargetPress;
                    complex_request_paras.OutletPipePara.Add(pipe_model);
                }
            }
@@ -157,8 +163,61 @@
                        new Calculation.DispatchAna.Model.ValvePara() { Name = valve.Name, OpenStatus = valve.Status });
                }
            }
            complex_request_paras.SchemeSortType = (Calculation.DispatchAna.Model.eAnaSchemeSortType)this.SortType;
            return complex_request_paras;
        }
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public IStation.Calculation.DispatchAna.Model.MachineRunPara BuildMachineRunPara(out string error_info)
        {
            error_info = null;
            List<IStation.Calculation.DispatchAna.Model.MachineRunFilter> machine_run_filter_list = null;
            if (this.RunStatusList == null)
            {
                // IStation.LogHelper.Info("RunStatusList none");
            }
            else if (this.RunStatusList.Count() == 0)
            {
                // IStation.LogHelper.Info("RunStatusList Count==0");
            }
            else //if (request.Setting.OpenStatus != null && request.Setting.OpenStatus.Count > 0)
            {
                machine_run_filter_list = new List<IStation.Calculation.DispatchAna.Model.MachineRunFilter>();
                foreach (var d in this.RunStatusList)
                {
                    var binding_list = new Service.PipeLineBinding().GetByPipeLineID(this.CorpID, d.MachineID);
                    machine_run_filter_list.Add(new IStation.Calculation.DispatchAna.Model.MachineRunFilter()
                    {
                        MachineID = binding_list.First().ID,
                        RunStatus = d.Status,
                        MaxFlow = -1
                    });
                }
            }
            return new IStation.Calculation.DispatchAna.Model.MachineRunPara()
            {
                MachineRunFilter = machine_run_filter_list
            };
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="error_info"></param>
        /// <returns></returns>
        public IStation.Calculation.DispatchAna.Model.EtaAnaRecord4Station BuildEtaAnaRecord(out string error_info)
        {
            error_info = null;
            if (EtaAnaRecord == null)
                return null;
            return EtaAnaRecord.Build(out error_info);
        }
    }