From fd681339c81201ed6fb3303647ecab89e3e6c0c1 Mon Sep 17 00:00:00 2001
From: Shuxia Ning <NingShuxia0927@outlook.com>
Date: 星期三, 17 七月 2024 09:50:11 +0800
Subject: [PATCH] 调度逻辑修改,新增笛卡尔积过滤循环

---
 Test/IStation.Win/View/ScheduleValidView.cs |  101 ++++++++++++++++++++++++--------------------------
 1 files changed, 48 insertions(+), 53 deletions(-)

diff --git a/Test/IStation.Win/View/ScheduleValidView.cs b/Test/IStation.Win/View/ScheduleValidView.cs
index e29f025..af82c25 100644
--- a/Test/IStation.Win/View/ScheduleValidView.cs
+++ b/Test/IStation.Win/View/ScheduleValidView.cs
@@ -13,8 +13,8 @@
             this.bandedGridView1.BandPanelRowHeight = 35;
             this.bandedGridView1.RegistCustomDrawRowIndicator();
             this.bandedGridView1.SetNormalView();
-           
-            this.cmbSelectStation.SelectedIndex = _sel_index - 1; 
+
+            this.cmbSelectStation.SelectedIndex = _sel_index - 1;
         }
 
 
@@ -209,7 +209,7 @@
 
         //璋冨害
         private void barBtnSchedule_Click(object sender, EventArgs e)
-        { 
+        {
             if (_schedule_valid_vm_list == null || !_schedule_valid_vm_list.Any())
             {
                 XtraMessageBox.Show("鏃犳暟鎹�!");
@@ -218,61 +218,56 @@
 
             try
             {
-                WaitHelper.ShowWaitForm();
-                var station = new Service.Station().Get();
-                List<Model.Pump> pumps;
-                List<int> flags_part1, flags_part2;
-                if (_sel_index == 1)
-                {
-                    pumps = station.S1;
-                    flags_part1 = station.S1FlagsPart1;
-                    flags_part2 = station.S1FlagsPart2;
-                }
-                else
-                {
-                    pumps = station.S2;
-                    flags_part1 = station.S2FlagsPart1;
-                    flags_part2 = station.S2FlagsPart2;
-                }
+                //WaitHelper.ShowWaitForm();
+                //var station = new Service.Station().Get();
+                //List<Model.Pump> pumps; 
+                //if (_sel_index == 1)
+                //{
+                //    pumps = station.Station1; 
+                //}
+                //else
+                //{
+                //    pumps = station.Station2; 
+                //}
 
-                var current_open_pump_list = new List<int>();
-                var must_open_pump_list = new List<int>();
-                var must_not_open_pump_list = new List<int>();
-                var schedule_helper = new Algorithm.ScheduleHelper();
+                //var current_open_pump_list = new List<int>();
+                //var must_open_pump_list = new List<int>();
+                //var must_not_open_pump_list = new List<int>();
+                //var schedule_helper = new Algorithm.ScheduleHelper();
 
-                foreach (var vm in _schedule_valid_vm_list)
-                {
-                    if (vm.FlagRpmDict == null || !vm.FlagRpmDict.Any())
-                        continue;
-                    current_open_pump_list = vm.FlagRpmDict.Select(x => x.Key).ToList();
-                    if (current_open_pump_list == null || current_open_pump_list.Count < 1)
-                        continue;
-                    var target_flow = vm.TotalFlowSrc;
-                    var target_head = vm.TotalHeadSrc;
+                //foreach (var vm in _schedule_valid_vm_list)
+                //{
+                //    if (vm.FlagRpmDict == null || !vm.FlagRpmDict.Any())
+                //        continue;
+                //    current_open_pump_list = vm.FlagRpmDict.Select(x => x.Key).ToList();
+                //    if (current_open_pump_list == null || current_open_pump_list.Count < 1)
+                //        continue;
+                //    var target_flow = vm.TotalFlowSrc;
+                //    var target_head = vm.TotalHeadSrc;
 
-                    var opt_schedule = schedule_helper.Calc(pumps, flags_part1, flags_part2, target_flow, target_head);
-                    if (opt_schedule != null)
-                    {
-                        vm.TotalFlowSchedule = opt_schedule.Flow;
-                        vm.TotalHeadSchedule = opt_schedule.Head;
-                        vm.TotalPowerSchedule = opt_schedule.Power;
-                        vm.RunFlagsSchedule = opt_schedule.Remark;
+                //    var opt_schedule = schedule_helper.GetOptAnaCombine(pumps,  target_flow, target_head);
+                //    if (opt_schedule != null)
+                //    {
+                //        vm.TotalFlowSchedule = opt_schedule.Flow;
+                //        vm.TotalHeadSchedule = opt_schedule.Head;
+                //        vm.TotalPowerSchedule = opt_schedule.Power;
+                //        vm.RunFlagsSchedule = opt_schedule.Remark;
 
-                        vm.TotalFlowScheduleSrcDiff = opt_schedule.Flow - target_flow;
-                        vm.TotalPowerScheduleSrcDiff = opt_schedule.Power - vm.TotalPowerSrc;
-                    }
+                //        vm.TotalFlowScheduleSrcDiff = opt_schedule.Flow - target_flow;
+                //        vm.TotalPowerScheduleSrcDiff = opt_schedule.Power - vm.TotalPowerSrc;
+                //    }
 
-                    var opt_src = schedule_helper.WorkingCalc(pumps, vm.FlagRpmDict, vm.FlagHeadDict, target_flow, target_head);
-                    if (opt_src != null)
-                    {
-                        vm.TotalFlowCalc = opt_src.Flow;
-                        vm.TotalPowerCalc = opt_src.Power;
+                //    var opt_src = schedule_helper.GetOptAnaCombineByWorking(pumps, vm.FlagRpmDict, vm.FlagHeadDict, target_flow, target_head);
+                //    if (opt_src != null)
+                //    {
+                //        vm.TotalFlowCalc = opt_src.Flow;
+                //        vm.TotalPowerCalc = opt_src.Power;
 
-                        vm.TotalFlowCalcSrcDiff = opt_src.Flow - target_flow;
-                        vm.TotalPowerCalcSrcDiff = opt_src.Power - vm.TotalPowerSrc;
-                    }
-                    vm.Round();
-                }
+                //        vm.TotalFlowCalcSrcDiff = opt_src.Flow - target_flow;
+                //        vm.TotalPowerCalcSrcDiff = opt_src.Power - vm.TotalPowerSrc;
+                //    }
+                //    vm.Round();
+                //}
 
                 this.scheduleValidViewModelBindingSource.DataSource = _schedule_valid_vm_list;
                 this.scheduleValidViewModelBindingSource.ResetBindings(false);
@@ -296,6 +291,6 @@
             _sel_index = this.cmbSelectStation.SelectedIndex + 1;
         }
 
-       
+
     }
 }

--
Gitblit v1.9.3