From 03a0d99de9c5fed6bea8bc83b49ce27786bda38c Mon Sep 17 00:00:00 2001
From: tangxu <tangxu76880903>
Date: 星期五, 07 二月 2025 09:29:59 +0800
Subject: [PATCH] 添加OPENAPI接口

---
 WebApi/Controllers/ZyPrjController.cs |  727 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 531 insertions(+), 196 deletions(-)

diff --git a/WebApi/Controllers/ZyPrjController.cs b/WebApi/Controllers/ZyPrjController.cs
index a8e5361..bf39aa0 100644
--- a/WebApi/Controllers/ZyPrjController.cs
+++ b/WebApi/Controllers/ZyPrjController.cs
@@ -15,7 +15,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using System.Web;
-using System.Web.Http; 
+using System.Web.Http;
 
 namespace IStation.ZyDto
 {
@@ -29,16 +29,13 @@
         //public int? StartOpenCount { get; set; } = -1;//宸蹭綔搴�
 
         public string StartReservoirLevel { get; set; }//寮�濮嬫按搴撴按浣�(鍙┖):鍗曚綅m
-        public List<int> StartOpenPumpIndexArray { get; set; }//寮�濮嬫満娉靛紑鏈虹姸鎬�(鏂�)
+        public string StartOpenPumpIndexArray { get; set; }//寮�濮嬫満娉靛紑鏈虹姸鎬�(涓嶅彲绌�)
 
         public string TotalFlowIn { get; set; }//鍙栨按鎬婚噺 (鍗曚綅 鍚�)
         public string TotalFlowOut { get; set; }//渚涙按鎬婚噺 (鍗曚綅 鍚�) 涓嶈緭鍏ュ氨鐢ㄩ娴嬪��
-       
+
         public string MaxReservoirLevel { get; set; }//鏈�楂樻按搴撴按浣嶉檺鍒�(鍙┖):鍗曚綅m
         public string MaxReservoirLevelTime { get; set; }//鏈�楂樻按搴撴按浣嶉檺鍒舵椂闂�(鍙┖) 鏃堕棿鏍煎紡
-
-        public string IsSubmit { get; set; }//璁$畻瀹�,鏄惁鎺ㄩ��
-        public string IsTemporary { get; set; }//鏄惁鏄复鏃剁畻涓�涓�(鏂�)
     }
 }
 
@@ -51,7 +48,7 @@
     public class ZyPrjController : ApiController
     {
         /// <summary>
-        ///
+        ///  璁$畻
         /// </summary>
         /// <param name="request"></param>
         /// <returns></returns>
@@ -59,7 +56,6 @@
         [HttpPost]
         public IStation.Dto.ApiResult Calc([FromBody] ZyPrjRequest request)
         {
-            LogHelper.Info(JsonHelper.Object2Json(request));
             if (request == null)
             {
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "request is null" };
@@ -72,6 +68,9 @@
             {
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "EndTime is null" };
             }
+            //
+            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;
@@ -95,22 +94,24 @@
                 IStation.LogHelper.Error(string.Format("ZyPrjRequest Time:{0}-{1} 鏃堕棿鑼冨洿閿欒,涓嶈兘瓒呰繃24灏忔椂", start_timme, end_timme));
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鏃堕棿鑼冨洿閿欒,涓嶈兘瓒呰繃24灏忔椂" };
             }
-
+   
             IStation.CalcModel.AnaRequest anaRequest = new AnaRequest();
             anaRequest.CalcOptType = (eCalcOptType)IStation.AnaGlobalParas.Setting.OptSortType;
             anaRequest.StartTime = start_timme;
             anaRequest.EndTime = end_timme;
             anaRequest.WaterLevels闀挎睙 = GetTide3Day(_tideSouce, start_timme);
+            if(anaRequest.WaterLevels闀挎睙 ==null || anaRequest.WaterLevels闀挎睙.Count()==0)
+            { 
+                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鏃犳硶鑾峰彇闀挎睙姘翠綅鏁版嵁" };
+            }
 
             #region 鍙栨按鎬婚噺
-            if (!string.IsNullOrEmpty(request.TotalFlowIn))
-            {
-                double TotalFlowIn = 0;
+            double TotalFlowIn = 0;
+            if (!string.IsNullOrEmpty(request.TotalFlowIn) && !string.IsNullOrWhiteSpace(request.TotalFlowIn))
+            { 
                 if (!double.TryParse(request.TotalFlowIn, out TotalFlowIn))
                 {
-                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  娉ㄦ剰鍙栨按鎬婚噺鍗曚綅鏄惃,褰撳墠鍙傛暟鍙傛暟杩囧皬",
-                start_timme, end_timme));
-                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "娉ㄦ剰鍙栨按鎬婚噺鍗曚綅鏄惃,褰撳墠鍙傛暟鍙傛暟杩囧皬" };
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璇疯緭鍏ユ暟瀛楀瀷鍙栨按鎬婚噺,鎺ュ彈鍒扮殑杈撳叆鍊兼槸:" + request.TotalFlowIn };
                 }
                 if (TotalFlowIn < 10000)
                 {
@@ -120,16 +121,18 @@
                 }
 
                 anaRequest.TotalFlowIn = TotalFlowIn;
-            } 
-            #endregion
+            }
 
-            #region  姘翠綅瑕佹眰
+            #endregion 鍙栨按鎬婚噺
+       
+            #region 姘翠綅瑕佹眰
+
             if (!string.IsNullOrEmpty(request.MaxReservoirLevelTime))
             {
                 anaRequest.MaxReservoirLevelTime = request.MaxReservoirLevelTime;
             }
 
-            if (!string.IsNullOrEmpty(request.MaxReservoirLevel))
+            if (!string.IsNullOrEmpty(request.MaxReservoirLevel) && !string.IsNullOrWhiteSpace(request.MaxReservoirLevel))
             {
                 double MaxReservoirLevel = 0;
                 if (!double.TryParse(request.MaxReservoirLevel, out MaxReservoirLevel))
@@ -144,17 +147,26 @@
             }
             else
             {
-                if (string.IsNullOrEmpty(request.TotalFlowIn))
-                { 
-                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  璇疯緭鍏ュ彇姘存�婚噺鎴栨按浣嶈姹�",
-                start_timme, end_timme));
+                if (string.IsNullOrEmpty(request.TotalFlowIn) || string.IsNullOrWhiteSpace(request.TotalFlowIn))
+                {
                     return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璇疯緭鍏ュ彇姘存�婚噺鎴栨按浣嶈姹�" };
                 }
-            } 
-            #endregion
+              
+                if (TotalFlowIn < 1000)
+                {
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璇疯緭鍏ュ彇姘存�婚噺,鎺ュ彈鍒扮殑杈撳叆鍊兼槸:" + request.TotalFlowIn };
+                }
+            }
+
+            #endregion 姘翠綅瑕佹眰
 
             #region 渚涙按閲�
-            if (string.IsNullOrEmpty(request.TotalFlowOut))
+
+            double TotalFlowOut鎵嬪姩杈撳叆闇�姹� = 0;//棰勬祴鍊肩殑渚涙按鎬婚噺(鍗曚綅 鍚�)
+            double TotalFlowOut棰勬祴鍊肩殑渚涙按鎬婚噺 = 0;//棰勬祴鍊肩殑渚涙按鎬婚噺 (鍗曚綅 鍚�)
+            double FlowTotalOut闇�姹� = 0;
+            bool isPredictRecord = false; //鏄惁鏄敤鍒版按閲忛娴�
+            if (string.IsNullOrEmpty(request.TotalFlowOut) || string.IsNullOrWhiteSpace(request.TotalFlowOut))
             {//鐢ㄩ娴嬪��
                 #region 鐢ㄩ娴嬪��
                 anaRequest.PerHourFlowOut = new List<double>();
@@ -188,20 +200,23 @@
                             Data = error_info11
                         };
                     }
-                    anaRequest.PerHourFlowOut.Add(r.LastPredictValue );//璁$畻涓敤鍚�
+                    TotalFlowOut棰勬祴鍊肩殑渚涙按鎬婚噺 += r.LastPredictValue;
+                    anaRequest.PerHourFlowOut.Add(r.LastPredictValue);//璁$畻涓敤鍚�
                 }
-                #endregion
+                IStation.LogHelper.Info(
+                    string.Format("鑾峰彇姘撮噺棰勬祴鍊�:  {0} ,  棰勬祴鍊兼�讳緵姘存�婚噺:{1} ", 
+                    string.Join(",", anaRequest.PerHourFlowOut), TotalFlowOut棰勬祴鍊肩殑渚涙按鎬婚噺));
+                FlowTotalOut闇�姹� = TotalFlowOut棰勬祴鍊肩殑渚涙按鎬婚噺;
+                isPredictRecord = true ;
+                #endregion 鐢ㄩ娴嬪��
             }
             else
             {
-                double TotalFlowOut = 0;
-                if (!double.TryParse(request.TotalFlowOut, out TotalFlowOut))
+                if (!double.TryParse(request.TotalFlowOut, out TotalFlowOut鎵嬪姩杈撳叆闇�姹�))
                 {
-                    IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  娉ㄦ剰鍙栨按鎬婚噺鍗曚綅鏄惃,褰撳墠鍙傛暟鍙傛暟杩囧皬",
-                start_timme, end_timme));
-                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "娉ㄦ剰渚涙按鎬婚噺鍗曚綅鏄惃,褰撳墠鍙傛暟鍙傛暟杩囧皬" };
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "娉ㄦ剰渚涙按鎬婚噺杈撳叆鍙傛暟鏃犳硶璇嗗埆,鍙傛暟鏄�:" + request.TotalFlowOut };
                 }
-                if (TotalFlowOut < 10000)
+                if (TotalFlowOut鎵嬪姩杈撳叆闇�姹� < 10000)
                 {
                     IStation.LogHelper.Info(string.Format("Zy Prj  Time:{0}-{1} ,  娉ㄦ剰鍙栨按鎬婚噺鍗曚綅鏄惃,褰撳墠鍙傛暟鍙傛暟杩囧皬",
                 start_timme, end_timme));
@@ -212,22 +227,39 @@
                 var count = (end_timme - start_timme).TotalHours;
                 for (var d = start_timme; d <= end_timme; d = d.AddHours(1))
                 {
-                    list.Add(Math.Round( TotalFlowOut / count,1));
+                    list.Add(Math.Round(TotalFlowOut鎵嬪姩杈撳叆闇�姹� / count, 1));
                 }
                 anaRequest.PerHourFlowOut = list;
-            } 
-            #endregion
 
+                FlowTotalOut闇�姹� = TotalFlowOut鎵嬪姩杈撳叆闇�姹�;
+                isPredictRecord = false ;
+            }
+
+            #endregion 渚涙按閲�
 
             //寮�濮嬫椂鐨勫紑鏈虹姸鎬�
-            if (request.StartOpenPumpIndexArray == null)
+            List<int> StartOpenPumpIndexArray = new List<int>();
+            if (!string.IsNullOrEmpty(request.StartOpenPumpIndexArray))
             {
-                IStation.LogHelper.Info(" 鏈缃紑濮嬫椂鏈烘车寮�鍋滅姸鎬� (Error: StartOpenPumpIndexArray is null)");
-                return new IStation.Dto.ApiResult<string>() { Code = ApiResultCode.Error, Data = "鏈缃紑濮嬫椂鏈烘车寮�鍋滅姸鎬� (Error: StartOpenPumpIndexArray is null)" };
+                var sss = request.StartOpenPumpIndexArray.Split(',');
+                foreach (var item in sss)
+                {
+                    if (int.TryParse(item, out int index))
+                    {
+                        if (index < 0 || index > 4)
+                        {
+                            return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "寮�濮嬫椂鐨勫紑鏈虹姸鎬�,鏈烘车瑙掓爣瑕佹眰涓嶈秴杩�4" };
+                        }
+                        StartOpenPumpIndexArray.Add(index);
+                    }
+                    else
+                    {
+                        return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "寮�濮嬫椂鐨勫紑鏈虹姸鎬�,鍙傛暟涓嶆纭�" };
+                    }
+                }
             }
             anaRequest.IsKnownStartOpenPump = true;
-            anaRequest.StartOpenPumpIndexArray = request.StartOpenPumpIndexArray;
-
+            anaRequest.StartOpenPumpIndexArray = StartOpenPumpIndexArray;
 
             //闄堣姘村簱姘翠綅
             if (string.IsNullOrEmpty(request.StartReservoirLevel))
@@ -247,50 +279,45 @@
                     anaRequest.StartReservoirLevel)
                 };
             }
-            bool isTemp = false;
-            if (!string.IsNullOrEmpty(request.IsTemporary))
-            {
-                isTemp = Convert.ToBoolean(request.IsTemporary);
-            }
 
+            IStation.LogHelper.Info("kashi 璁$畻鍙栨按鎬婚噺 ");
 
             var calcHelper = new IStation.CalcPrjHelper();
             AnaPrj defaultPrj = null;
             string error_info = calcHelper.Calc(anaRequest, out defaultPrj);
-           
+
             if (!string.IsNullOrEmpty(error_info) || defaultPrj == null)
             {
-                var er = string.Format("Zy Prj  Time:{0}-{1} ,  璁$畻閿欒, 鍘熷洜鏄�:{2} ,Request:::  {3}",
-                start_timme, end_timme, error_info, JsonHelper.Object2Json(anaRequest));
-                
-                IStation.LogHelper.Info(er);
+                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  Time:{0}-{1} ,  璁$畻鎴愬姛", start_timme, end_timme));
+                //  IStation.LogHelper.Info(string.Format("Zy Prj  璁$畻鎴愬姛:  \r\n {0}  ",  JsonHelper.Object2Json(defaultPrj)));
             }
+            IStation.LogHelper.Info("-----------------------------END--------------------------------------");
 
-            //淇濆瓨鏂规
-            if (!isTemp)
-            {
-                var ret = Common.HistoryAnaPrjFileHelper.SavePrj(IStation.AnaGlobalParas.Setting, anaRequest, defaultPrj);
-            }
-     
+            //淇濆瓨鏂规 
+            var ret = Common.HistoryAnaPrjFileHelper.SavePrj(IStation.AnaGlobalParas.Setting, isPredictRecord, anaRequest, defaultPrj);
 
+            //
             var dto_prj = ToPrjDto(defaultPrj);
+            dto_prj.FlowTotalOut = FlowTotalOut闇�姹�;
 
-            #region 鎺ㄩ��
 
-            if (!string.IsNullOrEmpty(request.IsSubmit) && Convert.ToBoolean(request.IsSubmit))
-            {
-                Task.Run(() =>
-                {
-                    _ = ZyProjectHelper.SubmitPrj(defaultPrj);
-                });
-            }
+            //鎺ㄩ��:浠g爜淇濈暀
+            //if (!string.IsNullOrEmpty(request.IsSubmit) && Convert.ToBoolean(request.IsSubmit))
+            //{
+            //    Task.Run(() =>
+            //    {
+            //        _ = ZyProjectHelper.SubmitPrj(defaultPrj);
+            //    });
+            //}
 
-            #endregion 鎺ㄩ��
+
+            //IStation.LogHelper.Info(string.Format(" 浜х敓璁$畻鏂规:{0}", dto_prj.schemeID));
+            //IStation.LogHelper.Info(string.Format("Zy Prj  璁$畻鎴愬姛:  \r\n {0}  ", JsonHelper.Object2Json(dto_prj)));
+
 
             return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success };
         }
@@ -314,17 +341,13 @@
                     return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day 鏍煎紡涓嶆纭�" };
                 }
 
-
-
                 IStation.CalcModel.AnaRequestBase requestBase;
-                var prj = Common.HistoryAnaPrjFileHelper.GetByEndTime(last_end_time, out requestBase);
+                var prj = Common.HistoryAnaPrjFileHelper.GetByEndTime澶т簬(last_end_time, out requestBase);
                 if (prj == null)
                 {
                     IStation.LogHelper.Info(string.Format("GetAnaStartPara 鏈壘鍒皗0}缁撴潫鐨勫垎鏋愰」鐩�", AnaStartTime));
                     return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = string.Format("鏈壘鍒皗0}缁撴潫鐨勫垎鏋愰」鐩�", AnaStartTime) };
                 }
-
-
 
                 IStation.CalcModel.ZyStartInfo zyStartInfo = new IStation.CalcModel.ZyStartInfo();
                 //zyStartInfo.OpenPumpStatus = prj.EndTimeOpenPumpStatus;
@@ -332,7 +355,6 @@
                 {
                     zyStartInfo.OpenPumpStatus = string.Join(",", prj.EndTimeOpenPumpStatus);
                 }
-
 
                 var near_pt = prj.NearPointTime(DateTime.Now);
                 if (near_pt == null)
@@ -351,12 +373,17 @@
                     return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鍦ㄩ」鐩腑, 鏈�鍚庝竴涓� BlockTime鐨� PointTimes 灞炴�у�间负绌�" };
                 }
                 var lz = prj.BlockTimes.Last().PointTimes.Last().WaterLevelH;
+                var lz_pt = prj.FindPointTime(last_end_time);
+                if (lz_pt != null)
+                {
+                    lz = lz_pt.WaterLevelH;
+                }
+
                 double start_yuce = lz + now_level - new_yuce;
 
+                IStation.LogHelper.Info(string.Format("GetAnaStartPara StartTime {0}    Level: {1},{2},{3} ,{4}  ", AnaStartTime, lz, now_level, new_yuce, start_yuce));
 
-               // IStation.LogHelper.Info(string.Format("GetAnaStartPara  {0},{1},{2},{3} ", lz , now_level , new_yuce, start_yuce));
-
-                zyStartInfo.ReservoirWaterLevel = start_yuce;
+                zyStartInfo.ReservoirWaterLevel = Math.Round(start_yuce, 3);
                 return new IStation.Dto.ApiResult<IStation.CalcModel.ZyStartInfo>(zyStartInfo) { Code = ApiResultCode.Success };
             }
             catch (Exception ex)
@@ -366,70 +393,30 @@
             }
         }
 
-        #region 鎹㈢畻鎴怐TO
-
-        private IStation.ZyDto.SubmitPrj ToPrjDto(AnaPrj defaultPrj)
+        /// <summary>
+        /// 纭璋冨害鏂规
+        /// </summary>
+        /// <param name="ana"></param>
+        /// <returns></returns>
+        [Route("ConfirmSchemeByID")]
+        [HttpPost]
+        public IStation.Dto.ApiResult ConfirmSchemeByID(string ID)
         {
-            IStation.ZyDto.SubmitPrj dto_prj = new ZyDto.SubmitPrj();
-
-            if (string.IsNullOrEmpty(defaultPrj.ID))
+            if (string.IsNullOrEmpty(ID) || ID == "string")
             {
-                var time = DateTime.Now;
-                defaultPrj.ID = $"{time.Year}{time.Month}{time.Day}{time.Hour}{time.Minute}{time.Second}";
+                return new IStation.Dto.ApiResult<bool>(false);
             }
-            dto_prj.schemeID = defaultPrj.ID;
-            dto_prj.Day = defaultPrj.StartTime.ToString("yyyy-MM-dd");
-            dto_prj.StartTime = defaultPrj.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
-            dto_prj.EndTime = defaultPrj.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
-
-            dto_prj.FlowTotal = Math.Round(defaultPrj.SumFlow, 0);
-            dto_prj.PowerTotal = Math.Round(defaultPrj.SumPower, 0);
-            dto_prj.MoneyTotal = Math.Round(defaultPrj.SumMoney, 0);
-
-            dto_prj.BlockTimes = new List<ZyDto.SubmitPrjBlockTime>();
-            foreach (var bt in defaultPrj.BlockTimes)
+            var dal = new IStation.DAL.AnaProject();
+            var info = dal.SetConfirmStatusByID(ID);
+            if (string.IsNullOrEmpty(info))
+                return new IStation.Dto.ApiResult<bool>(true);
+            else
             {
-                if (bt.OpenPumpIndexs  == null)
-                    continue;
-                ZyDto.SubmitPrjBlockTime dto_item = new ZyDto.SubmitPrjBlockTime();
-                dto_item.StartTime = bt.StartTime;
-                dto_item.EndTime = bt.EndTime;
-                dto_item.OpenPumpCount = bt.OpenPumpIndexs.Count;
-                dto_item.OpenPumpIndexs = bt.OpenPumpIndexs;
-                dto_item.StartSwitchGroupID = bt.StartSwitchGroupID;
-             
-                if (bt.PointTimes != null)
-                {
-                    dto_item.Records = new List<SubmitPrjTime>();
-                    foreach (var bt2 in bt.PointTimes)
-                    {
-                        dto_item.Records.Add(new SubmitPrjTime(bt2));
-                    }
-                }
-
-                dto_prj.BlockTimes.Add(dto_item);
+                IStation.LogHelper.Info(string.Format(" ConfirmSchemeByID error ID:{0}, reason:{1}", ID, info));
+                return new IStation.Dto.ApiResult<bool>(false);
             }
-
-            dto_prj.Switchs = new List<SubmitPrjSwitchInfo>();
-            if(defaultPrj.PumpSwitchs != null)
-            {
-                foreach (var bt in defaultPrj.PumpSwitchs)
-                { 
-                    ZyDto.SubmitPrjSwitchInfo dto_item = new ZyDto.SubmitPrjSwitchInfo();
-                    dto_item.GroupID = bt.GroupID;//鍒嗙粍ID
-                    dto_item.PumpIndex = bt.PumpIndex;//娉佃鏍�
-                    dto_item.Time = bt.Time.ToString("yyyy-MM-dd HH:mm:ss");//鏃堕棿
-                    dto_item.SwitchType = bt.SwitchType;///1 寮�鏈� 0 鍏虫満  
-
-                    dto_prj.Switchs.Add(dto_item);
-                }
-            }
-
-
-            return dto_prj;
         }
 
-        #endregion 鎹㈢畻鎴怐TO
 
 
         /// <summary>
@@ -450,23 +437,42 @@
             {
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "day 鏍煎紡涓嶆纭�" };
             }
-            IStation.CalcModel.AnaRequestBase requestBase = null;
-            var prj = Common.HistoryAnaPrjFileHelper.GetByStartDay(d, out requestBase);
+            
 
+            IStation.CalcModel.AnaRequestBase requestBase = null;
+            var prj = Common.HistoryAnaPrjFileHelper.GetByCreateDay(d, out requestBase);
             if (prj != null)
             {
+                //IStation.LogHelper.Info(string.Format(" api GetHistoryByDay {0}    format: {1}  OK", day, d));
                 var dto_prj = ToPrjDto(prj);
+                if (requestBase != null && requestBase.PerHourFlowOut != null)
+                {
+                    var sumFlow = (from x in requestBase.PerHourFlowOut select x).Sum();
+                    dto_prj.FlowTotalOut = sumFlow;
+                }
+                if(dto_prj.Switchs != null)
+                {
+                    var switch2 = from x in dto_prj.Switchs orderby x.Time select x;
+                    int index = 1;
+                    foreach (var sw in switch2)
+                    {
+                        sw.Index = index;
+                        index++;
+                    }
+                    dto_prj.Switchs = switch2.ToList();
+                }
+
                 return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success };
             }
             else
             {
+                IStation.LogHelper.Info(string.Format(" api GetHistoryByDay {0}    format: {1} (鏈壘鍒伴」鐩�) ", day, d));
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Alert, Message = "鏈壘鍒伴」鐩�" };
             }
         }
 
-
         /// <summary>
-        ///  鑾峰彇鏈�杩戜竴鏉�
+        ///  鑾峰彇鏈�杩戜竴鏉�(纭鐨�)
         /// </summary>
         /// <param name="day"></param>
         /// <returns></returns>
@@ -475,22 +481,96 @@
         public IStation.Dto.ApiResult GetLastHistoryRecord()
         {
             var dal = new IStation.DAL.AnaProject();
-            var record = dal.GetLastRecord();
+            var record = dal.GetLastConfirmRecord();
             if (record == null)
+            {
+                IStation.LogHelper.Info(" api GetLastHistoryRecord is null ");
                 return null;
-
+            }
+       
             IStation.CalcModel.AnaRequestBase requestBase = null;
             var prj = Common.HistoryAnaPrjFileHelper.GetByStartTime(record.StartTime, out requestBase);
             if (prj != null)
-            {
+            { 
                 var dto_prj = ToPrjDto(prj);
+                if (requestBase != null && requestBase.PerHourFlowOut != null)
+                {
+                    var sumFlow = (from x in requestBase.PerHourFlowOut select x).Sum();
+                    dto_prj.FlowTotalOut = sumFlow;
+                }
+                if (dto_prj.Switchs != null)
+                {
+                    var switch2 = from x in dto_prj.Switchs orderby x.Time select x;
+                    int index = 1;
+                    foreach (var sw in switch2)
+                    {
+                        sw.Index = index;
+                        index++;
+                    }
+                    dto_prj.Switchs = switch2.ToList();
+                }
                 return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success };
             }
             else
             {
+                IStation.LogHelper.Info(string.Format(
+                    " api GetLastHistoryRecord is null (鏈壘鍒伴」鐩�) LastRecord 淇℃伅: ID:{0}, StartTime:{1}, EndTime:{2}", 
+                    record.ID, 
+                    record.StartTime, record.EndTime));
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Alert, Message = "鏈壘鍒伴」鐩�" };
             }
         }
+
+        /// <summary>
+        ///  鑾峰彇鏈�杩戜竴鏉�(鏂板缓)
+        /// </summary>
+        /// <param name="day"></param>
+        /// <returns></returns>
+        [Route("GetLastCreateRecord")]
+        [HttpGet]
+        public IStation.Dto.ApiResult GetLastCreateRecord()
+        {
+            var dal = new IStation.DAL.AnaProject();
+            var record = dal.GetLastRecord();
+            if (record == null)
+            {
+                IStation.LogHelper.Info(" api GetLastHistoryRecord is null ");
+                return null;
+            }
+
+            IStation.CalcModel.AnaRequestBase requestBase = null;
+            var prj = Common.HistoryAnaPrjFileHelper.GetByStartTime(record.StartTime, out requestBase);
+            if (prj != null)
+            { 
+                var dto_prj = ToPrjDto(prj);
+                if (requestBase != null && requestBase.PerHourFlowOut != null )
+                {
+                    var sumFlow = (from x in requestBase.PerHourFlowOut select x).Sum();
+                    dto_prj.FlowTotalOut = sumFlow;
+                }
+                if (dto_prj.Switchs != null)
+                {
+                    var switch2 = from x in dto_prj.Switchs orderby x.Time select x;
+                    int index = 1;
+                    foreach (var sw in switch2)
+                    {
+                        sw.Index = index;
+                        index++;
+                    }
+                    dto_prj.Switchs = switch2.ToList();
+                }
+                return new IStation.Dto.ApiResult<IStation.ZyDto.SubmitPrj>(dto_prj) { Code = ApiResultCode.Success };
+            }
+            else
+            {
+                IStation.LogHelper.Info(string.Format(
+                    " api GetLastHistoryRecord is null (鏈壘鍒伴」鐩�) GetLastCreateRecord 淇℃伅: ID:{0}, StartTime:{1}, EndTime:{2}",
+                    record.ID,
+                    record.StartTime, record.EndTime));
+                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Alert, Message = "鏈壘鍒伴」鐩�" };
+            }
+        }
+
 
         /// <summary>
         ///
@@ -506,10 +586,40 @@
             dto_setting.MinSwitchTimeMinute = model_setting.MinSwitchTimeMinute;
             dto_setting.MaxPumpSwitchCount = model_setting.MaxPumpSwitchCount;
             dto_setting.OptSortType = model_setting.OptSortType;
-            dto_setting.OpenPumpIndexSequence = model_setting.OpenPumpIndexSequence;
-            dto_setting.ClosePumpIndexSequence = model_setting.ClosePumpIndexSequence;
             dto_setting.SwitchPumpMinuteSpace = model_setting.SwitchPumpMinuteSpace;
-            dto_setting.OptimalPumpIndexSequence = model_setting.OptimalPumpIndexSequence;
+
+            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);
+
+            //dto_setting.OpenPumpIndexSequence = BuildSequenceToDto(model_setting.OpenPumpIndexSequence);
+            //dto_setting.ClosePumpIndexSequence = BuildSequenceToDto(model_setting.ClosePumpIndexSequence);
+            //dto_setting.OptimalPumpIndexSequence = BuildSequenceToDto(model_setting.OptimalPumpIndexSequence);
+
+            //妫�淇车鐨勮鏍�, 0 琛ㄧず1鍙锋车 1 琛ㄧず浜屽彿娉� 涓虹┖,琛ㄧず娌℃湁妫�淇�
+            try
+            {
+                var overhallStatus = ZyConnectHelper.GetOverhaulStatus();
+                if (overhallStatus == null || overhallStatus.Count == 0)
+                {
+                    if (model_setting.UnablePumpIndexArray != null)
+                    {
+                        dto_setting.UnablePumpIndexArray = "";
+                        model_setting.UnablePumpIndexArray = null;
+                        IStation.Common.AnaSetting.SaveSetting(model_setting);
+                    }
+                }
+                else
+                {
+                    model_setting.UnablePumpIndexArray = overhallStatus.ToArray();
+                    dto_setting.UnablePumpIndexArray = string.Join(",", overhallStatus);
+                    IStation.Common.AnaSetting.SaveSetting(model_setting);
+                }
+            }
+            catch (Exception ex)
+            {
+                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鏃犳硶閾炬帴宸ユ帶鏈嶅姟鍣�,閿欒鍘熷洜:" + ex.Message };
+            }
 
             if (model_setting.SwitchPumpIgnoreTimes != null)
             {
@@ -542,6 +652,8 @@
                 }
             }
 
+            IStation.LogHelper.Info("ZyPrj GetSetting : Content: " + JsonHelper.Object2Json(dto_setting));
+
             return new IStation.Dto.ApiResult<IStation.Dto.ZyPrjAnaSetting>(dto_setting);
         }
 
@@ -556,10 +668,12 @@
         {
             if (dto == null)
             {
-                return new IStation.Dto.ApiResult<bool>(false);
+                return new IStation.Dto.ApiResult<bool>(false) { Message = "鍏ュ弬涓虹┖" };
             }
             var model_setting = IStation.AnaGlobalParas.Setting;
-            IStation.LogHelper.Info("ZyPrj SaveSetting");
+
+            IStation.LogHelper.Info("ZyPrj SaveSetting : Content: " + JsonHelper.Object2Json(dto));
+
             if (dto.MinOpenTimeMinute < 5)
             {
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鏈�灏戝紑娉垫椂闂� 璁剧疆杩囧皯" };
@@ -579,6 +693,11 @@
                 return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鏈�灏戝垏娉垫椂闂� 璁剧疆杩囬暱" };
             }
             model_setting.MinSwitchTimeMinute = dto.MinSwitchTimeMinute;
+            if (dto.SwitchPumpMinuteSpace < 2 || dto.SwitchPumpMinuteSpace > 30)
+            {
+                return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鍒囨崲娉垫椂闂撮棿闅� 璁剧疆涓嶅悎鐞�" };
+            }
+            model_setting.SwitchPumpMinuteSpace = dto.SwitchPumpMinuteSpace;
 
             if (dto.MaxPumpSwitchCount < 1)
             {
@@ -681,76 +800,170 @@
                     });
                 }
             }
- 
-            if (dto.OpenPumpIndexSequence != null)
+
+            if (!string.IsNullOrEmpty(dto.OpenPumpIndexSequence))
             {
-                List<int> penPumpIndexs = new List<int>();
-                foreach (var ind in dto.OpenPumpIndexSequence)
+                int[] new_set_sequence;
+                var error = BuildSequenceFromDto(dto.OpenPumpIndexSequence, out new_set_sequence);
+                if (!string.IsNullOrEmpty(error))
                 {
-                    if (ind < 0 || ind > 5)
-                    {
-                        return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "寮�娉甸『搴忚缃弬鏁颁笉鍚堢悊" };
-                    }
-                    else
-                    {
-                        penPumpIndexs.Add(ind);
-                    }
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "寮�娉甸『搴� " + error };
                 }
-                if (penPumpIndexs.Distinct().Count() != 5)
-                {
-                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "寮�娉甸『搴忚缃弬鏁颁笉鍚堢悊" };
-                }
-                model_setting.OpenPumpIndexSequence = penPumpIndexs.ToArray();
+
+                model_setting.OpenPumpIndexSequence = new_set_sequence;
             }
 
-            if (dto.ClosePumpIndexSequence != null)
+            if (!string.IsNullOrEmpty(dto.ClosePumpIndexSequence))// if (dto.ClosePumpIndexSequence != null)
             {
-                List<int> penPumpIndexs = new List<int>();
-                foreach (var ind in dto.ClosePumpIndexSequence)
+                int[] new_set_sequence;
+                var error = BuildSequenceFromDto(dto.ClosePumpIndexSequence, out new_set_sequence);
+                if (!string.IsNullOrEmpty(error))
                 {
-                    if (ind < 0 || ind > 5)
-                    {
-                        return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鍏虫车椤哄簭璁剧疆鍙傛暟涓嶅悎鐞�" };
-                    }
-                    else
-                    {
-                        penPumpIndexs.Add(ind);
-                    }
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鍏虫车椤哄簭 " + error };
                 }
-                if (penPumpIndexs.Distinct().Count() != 5)
-                {
-                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "鍏虫车椤哄簭璁剧疆鍙傛暟涓嶅悎鐞�" };
-                }
-                model_setting.ClosePumpIndexSequence = penPumpIndexs.ToArray();
+
+                model_setting.ClosePumpIndexSequence = new_set_sequence;
             }
 
-            if (dto.OptimalPumpIndexSequence != null)
+            if (!string.IsNullOrEmpty(dto.OptimalPumpIndexSequence))// if (dto.OptimalPumpIndexSequence != null)
             {
-                List<int> penPumpIndexs = new List<int>();
-                foreach (var ind in dto.OptimalPumpIndexSequence)
+                int[] new_set_sequence;
+                var error = BuildSequenceFromDto(dto.OptimalPumpIndexSequence, out new_set_sequence);
+                if (!string.IsNullOrEmpty(error))
                 {
-                    if (ind < 0 || ind > 5)
-                    {
-                        return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璋冨害娉典紭鍏堝害椤哄簭璁剧疆鍙傛暟涓嶅悎鐞�" };
-                    }
-                    else
-                    {
-                        penPumpIndexs.Add(ind);
-                    }
+                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璋冨害娉典紭鍏堝害椤哄簭 " + error };
                 }
-                if (penPumpIndexs.Distinct().Count() != 5)
-                {
-                    return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "璋冨害娉典紭鍏堝害椤哄簭璁剧疆鍙傛暟涓嶅悎鐞�" };
-                }
-                model_setting.OptimalPumpIndexSequence = penPumpIndexs.ToArray();
+
+                model_setting.OptimalPumpIndexSequence = new_set_sequence;
             }
+
+            //妫�淇姸鎬�, 鐩存帴璇籗CADA绯荤粺
+            //if (dto.UnablePumpIndexArray != null && dto.UnablePumpIndexArray.Count()>0)
+            //{
+            //    if (dto.UnablePumpIndexArray.Count() > 2)
+            //    {
+            //        return new IStation.Dto.ApiResult() { Code = ApiResultCode.Error, Message = "妫�淇车鏁伴噺涓嶈兘瓒呰繃2鍙� "  };
+            //    }
+            //    if (dto.UnablePumpIndexArray.Contains(5))
+            //    {
+            //        List<int> penPumpIndexs1 = new List<int>();
+            //        foreach (var p in dto.UnablePumpIndexArray)
+            //        {
+            //            penPumpIndexs1.Add(p - 1);
+            //        }
+            //        model_setting.UnablePumpIndexArray = penPumpIndexs1.ToArray();
+            //    }
+            //    else
+            //    {
+            //        model_setting.UnablePumpIndexArray = dto.UnablePumpIndexArray;
+            //    }
+            //    model_setting.Check_Optimal_UnablePumpIndexArray();
+            //}
+            //else
+            //{
+            //    model_setting.UnablePumpIndexArray = null;
+            //}
 
             return new IStation.Dto.ApiResult<bool>(IStation.Common.AnaSetting.SaveSetting(model_setting));
         }
 
+        /// <summary>
+        ///鑾峰彇鏈烘车妫�淇姸鎬�
+        /// </summary>
+        /// <returns></returns>
+        [Route("SynOverhaulStatus")]
+        [HttpGet]
+        public IStation.Dto.ApiResult SynOverhaulStatus()
+        {
+            var overhallStatus = ZyConnectHelper.GetOverhaulStatus();//妫�淇车鐨勮鏍�, 0 琛ㄧず1鍙锋车 1 琛ㄧず浜屽彿娉� 涓虹┖,琛ㄧず娌℃湁妫�淇�
+
+            return new IStation.Dto.ApiResult<List<int>>(overhallStatus);
+        }
+
+        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))
+            {
+                var sss = sequenceDto.Split(',');
+                foreach (var item in sss)
+                {
+                    if (int.TryParse(item, out int index))
+                    {
+                        list.Add(index);
+                    }
+                    else
+                    {
+                        return " 璁剧疆鍙傛暟涓嶅悎鐞�,鏈烘车搴忓彿鏈夐潪鏁板瓧";
+                    }
+                }
+            }
+
+            return BuildSequenceFromDto(list, out sequenceDs);
+        }
+
+        private string BuildSequenceFromDto(List<int> sequenceDto, out int[] sequenceDs)
+        {
+            sequenceDs = null;
+            if (sequenceDto == null || sequenceDto.Count() == 0)
+                return null;
+            List<int> penPumpIndexs = new List<int>();
+            foreach (var ind in sequenceDto)
+            {
+                if (ind < 0)
+                {
+                    return " 璁剧疆鍙傛暟涓嶅悎鐞�,鏈烘车搴忓彿鏈夎礋鏁�";
+                }
+                else if (ind > 5)
+                {
+                    return " 璁剧疆鍙傛暟涓嶅悎鐞�,鏈烘车搴忓彿瓒呰繃5";
+                }
+                else
+                {
+                    penPumpIndexs.Add(ind);
+                }
+            }
+            if (penPumpIndexs.Distinct().Count() != 5)
+            {
+                return " 璁剧疆鍙傛暟涓嶅悎鐞�";
+            }
+
+            if (penPumpIndexs.Contains(5))
+            {//琛ㄧず鐣岄潰浠�1 2 3 4 5
+                List<int> penPumpIndexs1 = new List<int>();
+                foreach (var p in penPumpIndexs)
+                {
+                    penPumpIndexs1.Add(p - 1);
+                }
+                sequenceDs = penPumpIndexs1.ToArray();
+            }
+            else
+            {
+                sequenceDs = penPumpIndexs.ToArray();
+            }
+            return null;
+        }
+
+        private int[] BuildSequenceToDto(int[] sequenceDs)
+        {
+            if (sequenceDs == null || sequenceDs.Length == 0) return null;
+
+            List<int> sequenceDto = new List<int>();
+
+            foreach (var sequence in sequenceDs)
+            {
+                sequenceDto.Add(sequence + 1);
+            }
+            return sequenceDto.ToArray();
+        }
+
         private Model.eTideSouce _tideSouce = Model.eTideSouce.Book;
 
-        public static List<Model.TimeWaterLevel> GetTide3Day(Model.eTideSouce  tideSouce, DateTime calc_day)
+        public static List<Model.TimeWaterLevel> GetTide3Day(Model.eTideSouce tideSouce, DateTime calc_day)
         {
             DateTime _rangDay1, _rangDay2, _rangDay3;
             string error1, error2, error3;
@@ -795,5 +1008,127 @@
 
             return timeValues;
         }
+
+        #region 鎹㈢畻鎴怐TO
+
+        private IStation.ZyDto.SubmitPrj ToPrjDto(AnaPrj defaultPrj)
+        {
+            IStation.ZyDto.SubmitPrj dto_prj = new ZyDto.SubmitPrj();
+
+            if (string.IsNullOrEmpty(defaultPrj.ID))
+            {
+                var time = DateTime.Now;
+                defaultPrj.ID = $"{time.Year}{time.Month}{time.Day}{time.Hour}{time.Minute}{time.Second}";
+            }
+            dto_prj.schemeID = defaultPrj.ID;
+            dto_prj.schemeName = defaultPrj.Name;
+            dto_prj.Day = defaultPrj.StartTime.ToString("yyyy-MM-dd");
+            dto_prj.StartTime = defaultPrj.StartTime.ToString("yyyy-MM-dd HH:mm:ss");
+            dto_prj.EndTime = defaultPrj.EndTime.ToString("yyyy-MM-dd HH:mm:ss");
+
+            dto_prj.FlowTotalIn = Math.Round(defaultPrj.SumFlow, 0);
+            dto_prj.FlowTotalOut = 0; //澶栭潰璧嬪��
+            dto_prj.PowerTotal = Math.Round(defaultPrj.SumPower, 0);
+            dto_prj.MoneyTotal = Math.Round(defaultPrj.SumMoney, 0);
+
+            dto_prj.BlockTimes = new List<ZyDto.SubmitPrjBlockTime>();
+
+            double startHeight = 0;
+
+            if (defaultPrj.BlockTimes != null)
+            {
+                startHeight = defaultPrj.BlockTimes.First().ReservoirStartHeight;
+                foreach (var bt in defaultPrj.BlockTimes)
+                {
+                    if (bt.OpenPumpIndexs == null)
+                        continue;
+                    ZyDto.SubmitPrjBlockTime dto_item = new ZyDto.SubmitPrjBlockTime();
+                    dto_item.StartTime = bt.StartTime;
+                    dto_item.EndTime = bt.EndTime;
+                    dto_item.OpenPumpCount = bt.OpenPumpIndexs.Count;
+                    dto_item.OpenPumpIndexs = bt.OpenPumpIndexs;
+                    dto_item.StartSwitchGroupID = bt.StartSwitchGroupID;
+
+                    if (bt.PointTimes != null)
+                    {
+                        dto_item.Records = new List<SubmitPrjTime>();
+                        foreach (var bt2 in bt.PointTimes)
+                        {
+                            //if(maxHeight < bt2.WaterLevelH)
+                            //{
+                            //    maxHeight = bt2.WaterLevelH;
+                            //    //maxHeight = Math.Max(maxHeight, bt2.WaterLevelH);
+                            //    maxHeightTime = bt2.Time;
+                            //}
+
+                            dto_item.Records.Add(new SubmitPrjTime(bt2));
+                        }
+                    }
+
+                    dto_prj.BlockTimes.Add(dto_item);
+                }
+            }
+            if (defaultPrj.MaxWaterLevelH <= 0)
+            {        
+                double maxHeight = 0;               
+                DateTime maxHeightTime = defaultPrj.StartTime;
+                if (defaultPrj.BlockTimes != null)
+                {
+                    foreach (var bt in defaultPrj.BlockTimes)
+                    {
+                        if (bt.OpenPumpIndexs == null)
+                            continue;
+
+                        if (bt.PointTimes != null)
+                        {
+                            foreach (var bt2 in bt.PointTimes)
+                            {
+                                if (maxHeight < bt2.WaterLevelH)
+                                {
+                                    maxHeight = bt2.WaterLevelH;
+                                    //maxHeight = Math.Max(maxHeight, bt2.WaterLevelH);
+                                    maxHeightTime = bt2.Time;
+                                }
+                            }
+                        }
+                    }
+                }
+                defaultPrj.MaxWaterLevelH = maxHeight;
+                defaultPrj.MaxWaterLevelTime = maxHeightTime;
+            }
+   
+            if(defaultPrj.MaxWaterLevelTime> defaultPrj.StartTime)
+            dto_prj.MaxWaterLevelH = string.Format("{0:N2}  ({1})",  Math.Round( defaultPrj.MaxWaterLevelH,2) ,
+                defaultPrj.MaxWaterLevelTime.ToString("HH:mm"));
+            else
+                dto_prj.MaxWaterLevelH = string.Format("{0:N2} ", Math.Round(defaultPrj.MaxWaterLevelH, 2));
+
+            //dto_prj.MaxWaterLevelH = defaultPrj.MaxWaterLevelH;
+            //dto_prj.MaxWaterLevelTime = defaultPrj.MaxWaterLevelTime;
+
+            dto_prj.StartWaterLevelH = string.Format("{0:N2}  ({1})", Math.Round(startHeight, 2),
+                defaultPrj.StartTime.ToString("HH:mm")); ;
+            dto_prj.Switchs = new List<SubmitPrjSwitchInfo>();
+            if (defaultPrj.PumpSwitchs != null)
+            {
+                var fi_PumpSwitchs = from x in defaultPrj.PumpSwitchs orderby x.Time select x;
+                foreach (var bt in fi_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");//鏃堕棿
+                    dto_item.SwitchType = bt.SwitchType;///1 寮�鏈� 0 鍏虫満
+
+                    dto_prj.Switchs.Add(dto_item);
+                }
+            }
+
+            return dto_prj;
+        }
+
+        #endregion 鎹㈢畻鎴怐TO
+
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3