From e3b3911774962c8f05c76424980aa9f30267d492 Mon Sep 17 00:00:00 2001
From: tangxu <tangxu76880903>
Date: 星期四, 05 九月 2024 10:22:35 +0800
Subject: [PATCH] Merge branch 'master' of http://47.103.154.90:83/r/IStation/shys/ChEqCalc.V1.3

---
 WebApi/Controllers/ZyPrjController.cs |   51 +++++++++++++++++++++++++--------------------------
 1 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/WebApi/Controllers/ZyPrjController.cs b/WebApi/Controllers/ZyPrjController.cs
index 4ad0564..592fa8a 100644
--- a/WebApi/Controllers/ZyPrjController.cs
+++ b/WebApi/Controllers/ZyPrjController.cs
@@ -55,7 +55,7 @@
         [Route("Calc")]
         [HttpPost]
         public IStation.Dto.ApiResult Calc([FromBody] ZyPrjRequest request)
-        { 
+        {
             if (request == null)
             {
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "request is null" };
@@ -71,8 +71,6 @@
             //
             IStation.LogHelper.Info("--------------------------START-----------------------------------------");
             IStation.LogHelper.Info(string.Format("Zy Prj Calc Request:  {0}", JsonHelper.Object2Json(request)));
- 
-
 
             DateTime start_timme = DateTime.Now;
             DateTime end_timme = DateTime.Now;
@@ -109,7 +107,7 @@
             {
                 double TotalFlowIn = 0;
                 if (!double.TryParse(request.TotalFlowIn, out TotalFlowIn))
-                { 
+                {
                     return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璇疯緭鍏ユ暟瀛楀瀷鍙栨按鎬婚噺,鎺ュ彈鍒扮殑杈撳叆鍊兼槸:" + request.TotalFlowIn };
                 }
                 if (TotalFlowIn < 10000)
@@ -153,7 +151,7 @@
                 double TotalFlowIn = 0;
                 if (!double.TryParse(request.TotalFlowIn, out TotalFlowIn))
                 {
-                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璇疯緭鍏ユ暟瀛楀瀷鍙栨按鎬婚噺,鎺ュ彈鍒扮殑杈撳叆鍊兼槸:"+ request.TotalFlowIn };
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璇疯緭鍏ユ暟瀛楀瀷鍙栨按鎬婚噺,鎺ュ彈鍒扮殑杈撳叆鍊兼槸:" + request.TotalFlowIn };
                 }
             }
 
@@ -202,14 +200,15 @@
                     TotalFlowOutPrecid += r.LastPredictValue;
                     anaRequest.PerHourFlowOut.Add(r.LastPredictValue);//璁$畻涓敤鍚�
                 }
-                IStation.LogHelper.Info(string.Format("  鑾峰彇姘撮噺棰勬祴鍊�:  {0}   ", string.Join(",",anaRequest.PerHourFlowOut)));
+                IStation.LogHelper.Info(string.Format("  鑾峰彇姘撮噺棰勬祴鍊�:  {0}   ", string.Join(",", anaRequest.PerHourFlowOut)));
+
                 #endregion 鐢ㄩ娴嬪��
             }
             else
             {
                 if (!double.TryParse(request.TotalFlowOut, out TotalFlowOut))
-                { 
-                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "娉ㄦ剰渚涙按鎬婚噺杈撳叆鍙傛暟鏃犳硶璇嗗埆,鍙傛暟鏄�:"+ request.TotalFlowOut };
+                {
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "娉ㄦ剰渚涙按鎬婚噺杈撳叆鍙傛暟鏃犳硶璇嗗埆,鍙傛暟鏄�:" + request.TotalFlowOut };
                 }
                 if (TotalFlowOut < 10000)
                 {
@@ -230,10 +229,10 @@
             #endregion 渚涙按閲�
 
             //寮�濮嬫椂鐨勫紑鏈虹姸鎬�
-            List<int> StartOpenPumpIndexArray = new List<int>();    
-            if (!string.IsNullOrEmpty(request.StartOpenPumpIndexArray  ))
+            List<int> StartOpenPumpIndexArray = new List<int>();
+            if (!string.IsNullOrEmpty(request.StartOpenPumpIndexArray))
             {
-                var sss = request.StartOpenPumpIndexArray.Split(','); 
+                var sss = request.StartOpenPumpIndexArray.Split(',');
                 foreach (var item in sss)
                 {
                     if (int.TryParse(item, out int index))
@@ -282,17 +281,17 @@
             string error_info = calcHelper.Calc(anaRequest, out defaultPrj);
 
             if (!string.IsNullOrEmpty(error_info) || defaultPrj == null)
-            { 
+            {
                 IStation.LogHelper.Info(string.Format("Zy Prj  璁$畻閿欒:  \r\n {0}  ", error_info));
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璁$畻閿欒, 鍘熷洜鏄�:" + error_info };
             }
             else
-            { 
-              //  IStation.LogHelper.Info(string.Format("Zy Prj  璁$畻鎴愬姛:  \r\n {0}  ",  JsonHelper.Object2Json(defaultPrj)));
+            {
+                //  IStation.LogHelper.Info(string.Format("Zy Prj  璁$畻鎴愬姛:  \r\n {0}  ",  JsonHelper.Object2Json(defaultPrj)));
             }
             IStation.LogHelper.Info("-----------------------------END--------------------------------------");
 
-            //淇濆瓨鏂规 
+            //淇濆瓨鏂规
             var ret = Common.HistoryAnaPrjFileHelper.SavePrj(IStation.AnaGlobalParas.Setting, anaRequest, defaultPrj);
 
             //
@@ -478,6 +477,7 @@
                 foreach (var bt in defaultPrj.PumpSwitchs)
                 {
                     ZyDto.SubmitPrjSwitchInfo dto_item = new ZyDto.SubmitPrjSwitchInfo();
+                    dto_item.Index = bt.Index;
                     dto_item.GroupID = bt.GroupID;//鍒嗙粍ID
                     dto_item.PumpIndex = bt.PumpIndex;//娉佃鏍�
                     dto_item.Time = bt.Time.ToString("yyyy-MM-dd HH:mm:ss");//鏃堕棿
@@ -569,7 +569,7 @@
             dto_setting.OptSortType = model_setting.OptSortType;
             dto_setting.SwitchPumpMinuteSpace = model_setting.SwitchPumpMinuteSpace;
 
-            dto_setting.OpenPumpIndexSequence = IStation.Dto.ZyPrjAnaSetting.ListToString( model_setting.OpenPumpIndexSequence);
+            dto_setting.OpenPumpIndexSequence = IStation.Dto.ZyPrjAnaSetting.ListToString(model_setting.OpenPumpIndexSequence);
             dto_setting.ClosePumpIndexSequence = IStation.Dto.ZyPrjAnaSetting.ListToString(model_setting.ClosePumpIndexSequence);
             dto_setting.OptimalPumpIndexSequence = IStation.Dto.ZyPrjAnaSetting.ListToString(model_setting.OptimalPumpIndexSequence);
 
@@ -595,14 +595,12 @@
                     model_setting.UnablePumpIndexArray = overhallStatus.ToArray();
                     dto_setting.UnablePumpIndexArray = string.Join(",", overhallStatus);
                     IStation.Common.AnaSetting.SaveSetting(model_setting);
-                } 
+                }
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
-                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鏃犳硶閾炬帴宸ユ帶鏈嶅姟鍣�,閿欒鍘熷洜:" + ex.Message};
+                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鏃犳硶閾炬帴宸ユ帶鏈嶅姟鍣�,閿欒鍘熷洜:" + ex.Message };
             }
-
-
 
             if (model_setting.SwitchPumpIgnoreTimes != null)
             {
@@ -857,12 +855,13 @@
 
             return new IStation.Dto.ApiResult<List<int>>(overhallStatus);
         }
-        private string BuildSequenceFromDto(string  sequenceDto, out int[] sequenceDs)
+
+        private string BuildSequenceFromDto(string sequenceDto, out int[] sequenceDs)
         {
             sequenceDs = null;
             if (string.IsNullOrEmpty(sequenceDto))
                 return null;
- 
+
             List<int> list = new List<int>();
             if (!string.IsNullOrEmpty(sequenceDto))
             {
@@ -880,10 +879,10 @@
                 }
             }
 
-            return BuildSequenceFromDto(list,out sequenceDs);
+            return BuildSequenceFromDto(list, out sequenceDs);
         }
-        
-        private string BuildSequenceFromDto(List<int>  sequenceDto, out int[] sequenceDs)
+
+        private string BuildSequenceFromDto(List<int> sequenceDto, out int[] sequenceDs)
         {
             sequenceDs = null;
             if (sequenceDto == null || sequenceDto.Count() == 0)

--
Gitblit v1.9.3