From ec22b14b0395df0ab97d1adf5b589a187bb62e59 Mon Sep 17 00:00:00 2001 From: ningshuxia <ningshuxia0927@outlook.com> Date: 星期二, 07 五月 2024 11:24:09 +0800 Subject: [PATCH] 调度接口(60) --- WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/StationDispatchOutput.cs | 56 - WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/helper/ExternalPipeScada.cs | 21 WebApi/IStation.Entry.Core/IStation.Entry.Core.csproj.user | 6 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/dto/output/DispatchSolutionOutput.cs | 0 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/dto/output/ScadaDispatchOutput.cs | 15 WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/StationDispatchInput.cs | 90 ++ WebApi/IStation.Application.Core/IStation.Application.Core.csproj | 14 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/dto/output/PumpDispatchOutput.cs | 0 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/dto/output/StationDispatchOutput.cs | 75 ++ WebApi/IStation.Application.Core/0-core/3-helper/Log - 复制.cs | 47 + WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/ScadaDispatchInput.cs | 8 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/DispatchSolution_Controller.cs | 379 +++++++++++++ IStation.WebApi.sln | 6 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/dto/input/FactoryDispatchInput.cs | 0 WebApi/IStation.Service.Core/IStation.Service.Core.csproj | 21 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/helper/TempOutHelper.cs | 128 ++++ WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/DispatchSolution_Controller - 复制.cs | 0 WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/dto/input/StationDispatchInput.cs | 46 + WebApi/IStation.Entry.Core/Properties/PublishProfiles/FolderProfile.pubxml.user | 5 WebApi/IStation.Service.Core/GlobalUsings.cs | 5 Schedule/IStation.Algorithm/Schedule/SchedulingHelper.cs | 296 ++++++++++ WebApi/IStation.Application.Core/1-dispatch/1-solution/DispatchSolution_Controller.cs | 452 ++++----------- WebApi/IStation.Application.Core/1-dispatch - 复制/1-solution/dto/input/ScadaDispatchInput.cs | 37 + WebApi/IStation.Application.Core/0-core/3-helper/Log.cs | 26 24 files changed, 1,307 insertions(+), 426 deletions(-) diff --git a/IStation.WebApi.sln b/IStation.WebApi.sln index 880e4c4..b7c9956 100644 --- a/IStation.WebApi.sln +++ b/IStation.WebApi.sln @@ -15,6 +15,8 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.WebApi.Core", "WebApi\IStation.WebApi.Core\IStation.WebApi.Core.csproj", "{8077F0D3-3FCC-44BF-8AB3-DF1A105CC798}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IStation.Algorithm", "Schedule\IStation.Algorithm\IStation.Algorithm.csproj", "{FAE82C28-80D5-4D50-93DC-CDBCF697793F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -45,6 +47,10 @@ {8077F0D3-3FCC-44BF-8AB3-DF1A105CC798}.Debug|Any CPU.Build.0 = Debug|Any CPU {8077F0D3-3FCC-44BF-8AB3-DF1A105CC798}.Release|Any CPU.ActiveCfg = Release|Any CPU {8077F0D3-3FCC-44BF-8AB3-DF1A105CC798}.Release|Any CPU.Build.0 = Release|Any CPU + {FAE82C28-80D5-4D50-93DC-CDBCF697793F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FAE82C28-80D5-4D50-93DC-CDBCF697793F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FAE82C28-80D5-4D50-93DC-CDBCF697793F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FAE82C28-80D5-4D50-93DC-CDBCF697793F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Schedule/IStation.Algorithm/Schedule/SchedulingHelper.cs b/Schedule/IStation.Algorithm/Schedule/SchedulingHelper.cs index c3af6bc..a9ba2a5 100644 --- a/Schedule/IStation.Algorithm/Schedule/SchedulingHelper.cs +++ b/Schedule/IStation.Algorithm/Schedule/SchedulingHelper.cs @@ -103,8 +103,299 @@ DAL.ScheduleAnaLog _dalAnaLog = new DAL.ScheduleAnaLog(); - /* private List<int> _combineFlags1 = new List<int>() { 11, 12, 13, 14, 16, 17, 18 }; - private List<int> _combineFlags2 = new List<int>() { 15 };*/ + public OptimalCombine AnaOptimalCombine(List<Pump> pumps, List<int> flags_part1, List<int> flags_part2, double target_flow, double target_head, List<int> current_open_pump_flags, List<int> must_open_pump_flags, List<int> must_not_open_pump_flags) + { + if (pumps == null || !pumps.Any()) + { + return default; + } + target_flow = Math.Round(target_flow, 1); + target_head = Math.Round(target_head, 1); + + #region 瀛樺湪-褰撳墠寮�娉靛垪琛� + + var exist_current_open_pump_flags = current_open_pump_flags != null && current_open_pump_flags.Count > 0; + + #endregion + + #region 瀛樺湪-蹇呭紑娉靛垪琛� + + var must_open_pump_flags_remark = string.Empty; + var exist_must_open_pump_flags = must_open_pump_flags != null && must_open_pump_flags.Count > 0; + if (exist_must_open_pump_flags) + { + must_open_pump_flags = must_open_pump_flags.OrderBy(x => x).ToList(); + must_open_pump_flags_remark = IntListHelper.ToString(must_open_pump_flags); + } + + #endregion + + #region 瀛樺湪-蹇呬笉鑳藉紑娉靛垪琛� + + var exist_must_not_open_pump_flags = must_not_open_pump_flags != null && must_not_open_pump_flags.Count > 0; + + #endregion + + var pump_flag_list = pumps.Select(x => x.ID).ToList(); + var optimal_combine_list = new List<OptimalCombine>(); + for (int pumpCount = 1; pumpCount <= pumps.Count; pumpCount++) + { + if (pumpCount == 1) + { + var max_total_flow = pumps.Max(x => x.Qr); + if (max_total_flow < target_flow) + continue; + } + var combine_list = PermutationAndCombination<int>.GetCombination(pump_flag_list.ToArray(), pumpCount);//鎺掑垪缁勫悎 + foreach (var combine in combine_list) + { + double combine_merit_ratio = 1;//缁勫悎鎷╀紭鐜� + if (exist_must_open_pump_flags) + { + var combine_remark = IntListHelper.ToString(combine.OrderBy(x => x)); + if (!combine_remark.Contains(must_open_pump_flags_remark)) + continue; + } + if (exist_must_not_open_pump_flags) + { + var exist_intersected = combine.Intersect(must_not_open_pump_flags).Count() > 0; + if (exist_intersected) + continue; + } + + int start_stop_count = 0;//鍚仠鏁伴噺 + if (exist_current_open_pump_flags) + { + var start_pump_count = combine.Except(current_open_pump_flags).Count(); + var close_pump_count = current_open_pump_flags.Except(combine).Count(); + start_stop_count = start_pump_count + close_pump_count;//鍚仠鏁伴噺 + } + else + { + start_stop_count = combine.Count(); + if (exist_must_open_pump_flags) + { + start_stop_count = combine.Except(must_open_pump_flags).Count(); + } + } + var total_loss_ratio = Math.Pow(_start_stop_loss_coefficient, start_stop_count);//鍚仠涓�娆℃崯澶变簺鑳借�� + combine_merit_ratio *= total_loss_ratio; + + List<int> combine_flag_list_part1 = new List<int>(); + List<int> combine_flag_list_part2 = new List<int>(); + foreach (var pump in combine) + { + if (flags_part1.Contains(pump)) + { + combine_flag_list_part1.Add(pump); + } + else + { + combine_flag_list_part2.Add(pump); + } + } + + //鍖哄垎鍚屽瀷鍙锋车 + List<FreCombine> fre_combine_list_part1 = new List<FreCombine>(); + List<FreCombine> fre_combine_list_part2 = new List<FreCombine>(); + + if (combine_flag_list_part1.Count > 0) + { + var conclusion_list_dic = new Dictionary<int, List<Entity.ScheduleConclusion>>(); + foreach (var flag in combine_flag_list_part1) + { + var runFlag = GetGFlag(flag); + if (conclusion_list_dic.ContainsKey(flag)) + continue; + var conclusionList = _dalScheduleConclusion.GetList(runFlag, target_head); + conclusion_list_dic[flag] = conclusionList; + } + + if (conclusion_list_dic.Count < 1) + { + continue; + } + + for (decimal fre = _frequency_max; fre >= _frequency_min; fre -= _frequency_space) + { + var freCombine = new FreCombine(); + freCombine.Frequency = (double)fre; + freCombine.Flags = new List<int>(); + foreach (var item in conclusion_list_dic) + { + var conclusion = item.Value.Find(x => x.Pump1 == (double)fre); + if (conclusion != null) + { + freCombine.Flags.Add(item.Key); + freCombine.Flow += conclusion.Flow; + freCombine.Power += conclusion.Power; + freCombine.RunCount++; + } + } + if (freCombine.Flags.Count < 1) + continue; + fre_combine_list_part1.Add(freCombine); + } + } + if (combine_flag_list_part2.Count > 0) + { + var conclusion_list_dic = new Dictionary<int, List<Entity.ScheduleConclusion>>(); + foreach (var flag in combine_flag_list_part2) + { + var runFlag = GetGFlag(flag); + if (conclusion_list_dic.ContainsKey(flag)) + continue; + var conclusionList = _dalScheduleConclusion.GetList(runFlag, target_head); + conclusion_list_dic[flag] = conclusionList; + } + + if (conclusion_list_dic.Count < 1) + { + continue; + } + + for (decimal fre = _frequency_max; fre >= _frequency_min; fre -= _frequency_space) + { + var freCombine = new FreCombine(); + freCombine.Frequency = (double)fre; + freCombine.Flags = new List<int>(); + foreach (var item in conclusion_list_dic) + { + var conclusion = item.Value.Find(x => x.Pump1 == (double)fre); + if (conclusion != null) + { + freCombine.Flags.Add(item.Key); + freCombine.Flow += conclusion.Flow; + freCombine.Power += conclusion.Power; + freCombine.RunCount++; + } + } + if (freCombine.Flags.Count < 1) + continue; + fre_combine_list_part2.Add(freCombine); + } + } + + if (fre_combine_list_part1.Count == 0 && fre_combine_list_part2.Count == 0) + continue; + + double total_flow_deviation = target_flow;//鎬绘祦閲忓亸宸� + double total_power = double.MaxValue;//鎬诲姛鐜� + double total_flow = double.MaxValue;//鎬绘祦閲� + + FreCombine optimal_combine_part1 = null; + FreCombine optimal_combine_part2 = null; + if (fre_combine_list_part1.Count < 1 || fre_combine_list_part2.Count < 1) + { + if (fre_combine_list_part1.Count < 1) + { + fre_combine_list_part1 = fre_combine_list_part2; + } + for (int Index_part1 = 0; Index_part1 < fre_combine_list_part1.Count; Index_part1++) + { + var fre_combine1 = fre_combine_list_part1[Index_part1]; + var current_flow = fre_combine1.Flow; + var current_power = fre_combine1.Power; + + var diff_flow = Math.Abs(current_flow - target_flow); + if (diff_flow < total_flow_deviation) + { + optimal_combine_part1 = fre_combine1; + total_power = fre_combine1.Power; + total_flow = current_flow; + total_flow_deviation = diff_flow; + } + + if (diff_flow < target_flow * 0.01 && current_power < total_power) + { + optimal_combine_part1 = fre_combine1; + total_power = fre_combine1.Power; + total_flow = current_flow; + } + } + } + else + { + for (int Index_part1 = 0; Index_part1 < fre_combine_list_part1.Count; Index_part1++) + { + for (int Index_part2 = 0; Index_part2 < fre_combine_list_part2.Count; Index_part2++) + { + var fre_combine1 = fre_combine_list_part1[Index_part1]; + var fre_combine2 = fre_combine_list_part2[Index_part2]; + + var current_flow = fre_combine1.Flow + fre_combine2.Flow; + var current_power = fre_combine1.Power + fre_combine2.Power; + + var diff_flow = Math.Abs(current_flow - target_flow); + if (diff_flow < total_flow_deviation) + { + optimal_combine_part1 = fre_combine1; + optimal_combine_part2 = fre_combine2; + total_power = fre_combine1.Power + fre_combine2.Power; + total_flow = current_flow; + total_flow_deviation = diff_flow; + } + + if (diff_flow < target_flow * 0.01 && current_power < total_power) + { + optimal_combine_part1 = fre_combine1; + optimal_combine_part2 = fre_combine2; + total_power = fre_combine1.Power + fre_combine2.Power; + total_flow = current_flow; + } + + } + } + } + + if (optimal_combine_part1 == null && optimal_combine_part2 == null) + continue; + + var total_flow_deviation_ratio = Math.Abs((1 - Math.Abs((total_flow / target_flow)))); + if (total_flow_deviation_ratio > _sel_opt_flow_deviation_ratio) + continue; + if (total_flow_deviation_ratio > _sel_opt_reasonable_flow_deviation_ratio) + { + combine_merit_ratio -= total_flow_deviation_ratio; + } + + + #region 鍒嗘瀽鏈�浼樼粍鍚堟柟妗� + + var optimal_combine = new OptimalCombine(); + optimal_combine.Combines = new List<FreCombine>(); + optimal_combine.Flags = new List<int>(); + if (optimal_combine_part1 != null) + { + optimal_combine.Combines.Add(optimal_combine_part1); + optimal_combine.Flags.AddRange(optimal_combine_part1.Flags); + } + if (optimal_combine_part2 != null) + { + optimal_combine.Combines.Add(optimal_combine_part2); + optimal_combine.Flags.AddRange(optimal_combine_part2.Flags); + } + optimal_combine.Flow = Math.Round(total_flow, 1); + optimal_combine.Power = Math.Round(total_power, 1); + optimal_combine.Flags = optimal_combine.Flags.OrderBy(x => x).ToList(); + optimal_combine.FlagCount = optimal_combine.Flags.Count; + optimal_combine.Remark = IntListHelper.ToString(optimal_combine.Flags); + + optimal_combine.MeritRatio = combine_merit_ratio; + optimal_combine.Head = Math.Round(target_head, 1); + optimal_combine_list.Add(optimal_combine); + + #endregion + } + } + + if (optimal_combine_list.Count < 1) + return default; + + optimal_combine_list = optimal_combine_list.OrderByDescending(x => x.MeritRatio).ToList(); + return optimal_combine_list.First(); + } + public string Ana(List<Pump> pumps, List<int> flags_part1, List<int> flags_part2, double target_flow, double target_head, List<int> current_open_pump_flags, List<int> must_open_pump_flags, List<int> must_not_open_pump_flags) { @@ -406,6 +697,7 @@ } + /// <summary> /// 鎻掑叆鍒嗘瀽鏃ュ織 /// </summary> diff --git "a/WebApi/IStation.Application.Core/0-core/3-helper/Log - \345\244\215\345\210\266.cs" "b/WebApi/IStation.Application.Core/0-core/3-helper/Log - \345\244\215\345\210\266.cs" new file mode 100644 index 0000000..f46d025 --- /dev/null +++ "b/WebApi/IStation.Application.Core/0-core/3-helper/Log - \345\244\215\345\210\266.cs" @@ -0,0 +1,47 @@ +锘縩amespace IStation.Application +{ + /// <summary> + /// + /// </summary> + public class Log + { + /// <summary> + /// 鍐欏叆淇℃伅鏃ュ織 + /// </summary> + /// <param name="flowId"></param> + /// <param name="info"></param> + public static void Info(string flowId, string info) + { + + Yw.LogHelper.Info(GetLogInfo(flowId, info)); + } + + /// <summary> + /// 鍐欏叆璋冭瘯鏃ュ織 + /// </summary> + /// <param name="flowId"></param> + /// <param name="info"></param> + public static void Debug(s string info) + { + Yw.LogHelper.Debug(GetLogInfo(flowId, info)); + } + + + /// <summary> + /// 鍐欏叆閿欒鏃ュ織 + /// </summary> + /// <param name="flowId"></param> + /// <param name="info"></param> + /// <param name="ex"></param> + public static void Error(string flowId, string info, Exception ex = null) + { + Yw.LogHelper.Error(GetLogInfo(flowId, info), ex); + } + + + private static string GetLogInfo(string info) + { + return $"{flowId}:{info}"; + } + } +} diff --git a/WebApi/IStation.Application.Core/0-core/3-helper/Log.cs b/WebApi/IStation.Application.Core/0-core/3-helper/Log.cs index 2bc70ef..6cf627d 100644 --- a/WebApi/IStation.Application.Core/0-core/3-helper/Log.cs +++ b/WebApi/IStation.Application.Core/0-core/3-helper/Log.cs @@ -7,42 +7,38 @@ { /// <summary> /// 鍐欏叆淇℃伅鏃ュ織 - /// </summary> - /// <param name="flowId"></param> + /// </summary> /// <param name="info"></param> - public static void Info(string flowId, string info) + public static void Info(string info) { - Yw.LogHelper.Info(GetLogInfo(flowId, info)); + Yw.LogHelper.Info(GetLogInfo(info)); } - - /// <summary> /// 鍐欏叆璋冭瘯鏃ュ織 - /// </summary> - /// <param name="flowId"></param> + /// </summary> /// <param name="info"></param> - public static void Debug(string flowId, string info) + public static void Debug(string info) { - Yw.LogHelper.Debug(GetLogInfo(flowId, info)); + Yw.LogHelper.Debug(GetLogInfo(info)); } /// <summary> /// 鍐欏叆閿欒鏃ュ織 - /// </summary> + /// </summary> /// <param name="info"></param> /// <param name="ex"></param> - public static void Error(string flowId, string info, Exception ex = null) + public static void Error(string info, Exception ex = null) { - Yw.LogHelper.Error(GetLogInfo(flowId, info), ex); + Yw.LogHelper.Error(GetLogInfo(info), ex); } - private static string GetLogInfo(string flowId, string info) + private static string GetLogInfo(string info) { - return $"{flowId}:{info}"; + return $"{info}"; } } } diff --git "a/WebApi/IStation.Application.Core/1-dispatch/1-solution/DispatchSolution_Controller - \345\244\215\345\210\266.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/DispatchSolution_Controller - \345\244\215\345\210\266.cs" similarity index 100% rename from "WebApi/IStation.Application.Core/1-dispatch/1-solution/DispatchSolution_Controller - \345\244\215\345\210\266.cs" rename to "WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/DispatchSolution_Controller - \345\244\215\345\210\266.cs" diff --git "a/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/DispatchSolution_Controller.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/DispatchSolution_Controller.cs" new file mode 100644 index 0000000..7380c86 --- /dev/null +++ "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/DispatchSolution_Controller.cs" @@ -0,0 +1,379 @@ +锘縩amespace IStation.Application +{ + /// <summary> + /// 璋冨害鏂规 + /// </summary> + [Route("OpenApi/Dispatch/Solution")] + [ApiDescriptionSettings("Solution", Name = "闄堣璋冨害鏂规", Order = 1)] + public class DispatchSolution_Controller : IDynamicApiController + { + + /// <summary> + /// 璁$畻 + /// </summary> + [AllowAnonymous] + [Route("Calculate@V1.0")] + [HttpPost] + public async Task<DispatchSolutionOutput> Calculate([Required] StationDispatchInput input) + { + if (input == null) + return null; + + string flowId = input.FlowId; + Log.Debug(flowId, JsonHelper.Object2Json(input)); + + var scadaInput = GetScadaDispatchInput(DateTime.Now.AddSeconds(300), DateTime.Now); + var scadaOutput = await GetRealScada(flowId, scadaInput); + if (scadaOutput == null || scadaOutput.Scadas == null) + { + Log.Info(flowId, "Scada:鏁版嵁鑾峰彇澶辫触锛岃皟搴︾粓姝�!"); + throw YOops.Oh(eResultCode.Error, InternalErrorCodes.L001, "Scada:鏁版嵁鑾峰彇澶辫触锛岃皟搴︾粓姝�!"); + } + + return TempOutHelper.GetDispatchSolutionOutput(input.FlowId); + } + + private async Task<ScadaDispatchOutput> GetRealScada(string flowId, ScadaDispatchInput input) + { + if (input == null) + { + Log.Info(flowId, "ScadaDispatchInput is null"); + return default; + } + + var ws = new ClientWebSocket(); + ws.Options.RemoteCertificateValidationCallback = delegate { return true; }; + await ws.ConnectAsync(new Uri("ws://localhost:5102/api/WebSocket/GetNotReadCount"), CancellationToken.None); + if (ws.State != WebSocketState.Open) + { + Log.Info(flowId, "webSocket:杩炴帴澶辫触!"); + return default; + } + Log.Info(flowId, "webSocket:杩炴帴鎴愬姛!"); + + ScadaDispatchOutput output = null; + var inputJson = JsonHelper.Object2Json(input); + Log.Debug(flowId, inputJson); + var inputBytes = Encoding.UTF8.GetBytes(inputJson); + await ws.SendAsync(inputBytes, WebSocketMessageType.Text, true, CancellationToken.None); + try + { + List<byte> outputBytes = new List<byte>();//鍏ㄩ儴娑堟伅瀹瑰櫒 + var buffer = new byte[1024 * 4];//缂撳啿鍖� + var result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None); //鐩戝惉Socket淇℃伅 + while (!result.CloseStatus.HasValue) //鏄惁鍏抽棴 + { + if (result.MessageType == WebSocketMessageType.Text)//鏂囨湰娑堟伅 + { + outputBytes.AddRange(buffer.Take(result.Count)); + if (result.EndOfMessage)//娑堟伅鏄惁宸叉帴鏀跺畬鍏� + { + //鍙戦�佽繃鏉ョ殑娑堟伅 + string outputJson = Encoding.UTF8.GetString(outputBytes.ToArray(), 0, outputBytes.Count); + output = new ScadaDispatchOutput(); + output.Scadas = JsonHelper.Json2Object<Dictionary<string, Dictionary<DateTime, string>>>(outputJson); + break; + } + } + result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);//缁х画鐩戝惉Socket淇℃伅 + } + } + catch (Exception ex) + { + Log.Error(flowId, ex.Message); + } + finally + { + try + { + //鍏抽棴WebSocket + await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "AcknowledgeCloseframe", CancellationToken.None); + } + catch (Exception ex) + { + Log.Error(flowId, "鍏抽棴WebSocket寮傚父", ex); + } + ws.Abort(); + ws.Dispose(); + } + + return output; + } + + + private ScadaDispatchInput GetScadaDispatchInput(DateTime startTime, DateTime endTime, double resolution = 300) + { + + var tagDict = new Dictionary<string, string> + { + //{ "_0402010204089903001", "闀挎睙姘翠綅" }, + //{ "_0402010204089904009", "浜屽彇姘村墠姹犳恫浣�" }, + //{ "_0402010201030103006", "闄堣姘村簱姘翠綅" }, + //{ "_0402010204012101001", "浜屽彇姘�1鍙锋车鐘舵��" }, + //{ "_0402010204012201001", "浜屽彇姘�2鍙锋车鐘舵��" }, + //{ "_0402010204012301001", "浜屽彇姘�3鍙锋车鐘舵��" }, + //{ "_0402010204012401001", "浜屽彇姘�4鍙锋车鐘舵��" }, + //{ "_0402010204012501001", "浜屽彇姘�5鍙锋车鐘舵��" }, + //{ "_0402010204012103002", "浜屽彇姘�1鍙锋车绱娴侀噺" }, + //{ "_0402010204012203002", "浜屽彇姘�2鍙锋车绱娴侀噺" }, + //{ "_0402010204012303002", "浜屽彇姘�3鍙锋车绱娴侀噺" }, + //{ "_0402010204012403002", "浜屽彇姘�4鍙锋车绱娴侀噺" }, + //{ "_0402010204012503002", "浜屽彇姘�5鍙锋车绱娴侀噺" }, + //{ "_0402010204040193046", "浜屽彇姘�1鍙锋车鏈夊姛鐢佃兘" }, + //{ "_0402010204040193047", "浜屽彇姘�2鍙锋车鏈夊姛鐢佃兘" }, + //{ "_0402010204012308007", "浜屽彇姘�3鍙锋车鏈夊姛鐢佃兘" }, + //{ "_0402010204012408007", "浜屽彇姘�4鍙锋车鏈夊姛鐢佃兘" }, + //{ "_0402010204012508007", "浜屽彇姘�5鍙锋车鏈夊姛鐢佃兘" }, + { "_0402010201090105774", "涓�杈撴按11鍙峰嚭鍙e帇鍔�" }, + { "_0402010201040502031", "涓�杈撴按11鍙锋湁鍔熷姛鐜�" }, + { "_0402010201040502044", "涓�杈撴按11鍙锋湁鍔熺數搴�" }, + { "_0402010201011195062", "涓�杈撴按11鍙锋车杞��" }, + { "_0402010201011101001", "涓�杈撴按11鍙锋车杩愯鐘舵��" }, + { "_0402010201011194012", "涓�杈撴按11鍙锋车棰戠巼" }, + { "_0402010201090105005", "涓�杈撴按12鍙峰嚭鍙e帇鍔�" }, + { "_0402010201041402031", "涓�杈撴按12鍙锋湁鍔熷姛鐜�" }, + { "_0402010201041402044", "涓�杈撴按12鍙锋湁鍔熺數搴�" }, + { "_0402010201011295062", "涓�杈撴按12鍙锋车杞��" }, + { "_0402010201011201001", "涓�杈撴按12鍙锋车杩愯鐘舵��" }, + { "_0402010201011294012", "涓�杈撴按12鍙锋车棰戠巼" }, + { "_0402010201090105776", "涓�杈撴按13鍙峰嚭鍙e帇鍔�" }, + { "_0402010201040602031", "涓�杈撴按13鍙锋湁鍔熷姛鐜�" }, + { "_0402010201040602044", "涓�杈撴按13鍙锋湁鍔熺數搴�" }, + { "_0402010201011395062", "涓�杈撴按13鍙锋车杞��" }, + { "_0402010201011301001", "涓�杈撴按13鍙锋车杩愯鐘舵��" }, + { "_0402010201011394012", "涓�杈撴按13鍙锋车棰戠巼" }, + { "_0402010201090105007", "涓�杈撴按14鍙峰嚭鍙e帇鍔�" }, + { "_0402010201041302031", "涓�杈撴按14鍙锋湁鍔熷姛鐜�" }, + { "_0402010201041302044", "涓�杈撴按14鍙锋湁鍔熺數搴�" }, + { "_0402010201011495062", "涓�杈撴按14鍙锋车杞��" }, + { "_0402010201011401001", "涓�杈撴按14鍙锋车杩愯鐘舵��" }, + { "_0402010201011494012", "涓�杈撴按14鍙锋车棰戠巼" }, + { "_0402010201090105008", "涓�杈撴按15鍙峰嚭鍙e帇鍔�" }, + { "_0402010201040702031", "涓�杈撴按15鍙锋湁鍔熷姛鐜�" }, + { "_0402010201040702044", "涓�杈撴按15鍙锋湁鍔熺數搴�" }, + { "_0402010201011595062", "涓�杈撴按15鍙锋车杞��" }, + { "_0402010201011501003", "涓�杈撴按15鍙锋车杩愯鐘舵��" }, + { "_0402010201090105016", "涓�杈撴按16鍙峰嚭鍙e帇鍔�" }, + { "_0402010201041202031", "涓�杈撴按16鍙锋湁鍔熷姛鐜�" }, + { "_0402010201041202044", "涓�杈撴按16鍙锋湁鍔熺數搴�" }, + { "_0402010201011695062", "涓�杈撴按16鍙锋车杞��" }, + { "_0402010201011601003", "涓�杈撴按16鍙锋车杩愯鐘舵��" }, + { "_0402010201090105017", "涓�杈撴按17鍙峰嚭鍙e帇鍔�" }, + { "_0402010201040802031", "涓�杈撴按17鍙锋湁鍔熷姛鐜�" }, + { "_0402010201040802044", "涓�杈撴按17鍙锋湁鍔熺數搴�" }, + { "_0402010201011795062", "涓�杈撴按17鍙锋车杞��" }, + { "_0402010201011795056", "涓�杈撴按17鍙锋车杩愯鐘舵��" }, + { "_0402010201090105018", "涓�杈撴按18鍙峰嚭鍙e帇鍔�" }, + { "_0402010201041102031", "涓�杈撴按18鍙锋湁鍔熷姛鐜�" }, + { "_0402010201041102044", "涓�杈撴按18鍙锋湁鍔熺數搴�" }, + { "_0402010201011895062", "涓�杈撴按18鍙锋车杞��" }, + { "_0402010201011895056", "涓�杈撴按18鍙锋车杩愯鐘舵��" }, + { "_0402010201090104011", "涓�杈撴按鍓嶆睜娑蹭綅1" }, + { "_0402010201091104123", "涓�杈撴按鍓嶆睜娑蹭綅2" }, + { "_0402010201091104122", "涓�杈撴按鍓嶆睜娑蹭綅3" }, + { "_0402010201090105002", "涓�杈撴按鍢夊畾1绾垮帇鍔�" }, + { "_0402010201030191001", "涓�杈撴按鍢夊畾1绾跨灛鏃舵祦閲�" }, + { "_0402010201030191002", "涓�杈撴按鍢夊畾1绾跨疮璁℃祦閲�" }, + { "_0402010201090105011", "涓�杈撴按鍢夊畾2绾垮帇鍔�" }, + { "_0402010201090199011", "涓�杈撴按鍢夊畾2绾跨灛鏃舵祦閲�" }, + { "_0402010201090199012", "涓�杈撴按鍢夊畾2绾跨疮璁℃祦閲�" }, + { "_0402010201090105784", "涓�杈撴按鍢夊畾3绾垮帇鍔�" }, + { "_0402010201090199311", "涓�杈撴按鍢夊畾3绾跨灛鏃舵祦閲�" }, + { "_0402010201090199312", "涓�杈撴按鍢夊畾3绾跨疮璁℃祦閲�" }, + { "_0402010204012105001", "浜屽彇姘翠竴鍙锋満娉靛嚭鍙e帇鍔�" }, + { "_0402010204012101001", "浜屽彇姘翠竴鍙锋満娉靛紑鍋滅姸鎬�" }, + { "_0402010204040193004", "浜屽彇姘翠竴鍙锋満娉垫湁鍔熷姛鐜�" }, + { "_0402010204040193046", "浜屽彇姘翠竴鍙锋満娉垫湁鍔熺數搴�" }, + { "_0402010204012103001", "浜屽彇姘翠竴鍙锋満娉电灛鏃舵祦閲�" }, + { "_0402010204012103002", "浜屽彇姘翠竴鍙锋満娉电疮璁℃祦閲�" }, + { "_0402010204012305001", "浜屽彇姘翠笁鍙锋満娉靛嚭鍙e帇鍔�" }, + { "_0402010204012301001", "浜屽彇姘翠笁鍙锋満娉靛紑鍋滅姸鎬�" }, + { "_0402010204012308008", "浜屽彇姘翠笁鍙锋満娉垫湁鍔熷姛鐜�" }, + { "_0402010204012308007", "浜屽彇姘翠笁鍙锋満娉垫湁鍔熺數搴�" }, + { "_0402010204012303001", "浜屽彇姘翠笁鍙锋満娉电灛鏃舵祦閲�" }, + { "_0402010204012303002", "浜屽彇姘翠笁鍙锋満娉电疮璁℃祦閲�" }, + { "_0402010204012205001", "浜屽彇姘翠簩鍙锋満娉靛嚭鍙e帇鍔�" }, + { "_0402010204012201001", "浜屽彇姘翠簩鍙锋満娉靛紑鍋滅姸鎬�" }, + { "_0402010204040193005", "浜屽彇姘翠簩鍙锋満娉垫湁鍔熷姛鐜�" }, + { "_0402010204040193047", "浜屽彇姘翠簩鍙锋満娉垫湁鍔熺數搴�" }, + { "_0402010204012203001", "浜屽彇姘翠簩鍙锋満娉电灛鏃舵祦閲�" }, + { "_0402010204012203002", "浜屽彇姘翠簩鍙锋満娉电疮璁℃祦閲�" }, + { "_0402010204012505001", "浜屽彇姘翠簲鍙锋満娉靛嚭鍙e帇鍔�" }, + { "_0402010204012501001", "浜屽彇姘翠簲鍙锋満娉靛紑鍋滅姸鎬�" }, + { "_0402010204012508008", "浜屽彇姘翠簲鍙锋満娉垫湁鍔熷姛鐜�" }, + { "_0402010204012508007", "浜屽彇姘翠簲鍙锋満娉垫湁鍔熺數搴�" }, + { "_0402010204012503001", "浜屽彇姘翠簲鍙锋満娉电灛鏃舵祦閲�" }, + { "_0402010204012503002", "浜屽彇姘翠簲鍙锋満娉电疮璁℃祦閲�" }, + { "_0402010204089904009", "浜屽彇姘村墠姹犳恫浣�" }, + { "_0402010204012405001", "浜屽彇姘村洓鍙锋満娉靛嚭鍙e帇鍔�" }, + { "_0402010204012401001", "浜屽彇姘村洓鍙锋満娉靛紑鍋滅姸鎬�" }, + { "_0402010204012408008", "浜屽彇姘村洓鍙锋満娉垫湁鍔熷姛鐜�" }, + { "_0402010204012408007", "浜屽彇姘村洓鍙锋満娉垫湁鍔熺數搴�" }, + { "_0402010204012403001", "浜屽彇姘村洓鍙锋満娉电灛鏃舵祦閲�" }, + { "_0402010204012403002", "浜屽彇姘村洓鍙锋満娉电疮璁℃祦閲�" }, + { "_0402010201012105001", "浜岃緭姘�21鍙锋车鍑哄彛鍘嬪姏" }, + { "_0402010201040102049", "浜岃緭姘�21鍙锋车鏈夊姛鍔熺巼" }, + { "_0402010201040102187", "浜岃緭姘�21鍙锋车鏈夊姛鐢靛害" }, + { "_0402010201090103901", "浜岃緭姘�21鍙锋车鐬椂娴侀噺" }, + { "_0402010201010294045", "浜岃緭姘�21鍙锋车绱娴侀噺" }, + { "_0402010201012199001", "浜岃緭姘�21鍙锋车杞��" }, + { "_0402010201012193021", "浜岃緭姘�21鍙锋车杩愯鐘舵��" }, + { "_0402010201040102178", "浜岃緭姘�21鍙锋车棰戠巼" }, + { "_0402010201012205001", "浜岃緭姘�22鍙锋车鍑哄彛鍘嬪姏" }, + { "_0402010201040102053", "浜岃緭姘�22鍙锋车鏈夊姛鍔熺巼" }, + { "_0402010201040102213", "浜岃緭姘�22鍙锋车鏈夊姛鐢靛害" }, + { "_0402010201090103001", "浜岃緭姘�22鍙锋车鐬椂娴侀噺" }, + { "_0402010201090103002", "浜岃緭姘�22鍙锋车绱娴侀噺" }, + { "_0402010201012299001", "浜岃緭姘�22鍙锋车杞��" }, + { "_0402010201012201001", "浜岃緭姘�22鍙锋车杩愯鐘舵��" }, + { "_0402010201040102204", "浜岃緭姘�22鍙锋车棰戠巼" }, + { "_0402010201012305001", "浜岃緭姘�23鍙锋车鍑哄彛鍘嬪姏" }, + { "_0402010201040102055", "浜岃緭姘�23鍙锋车鏈夊姛鍔熺巼" }, + { "_0402010201040102136", "浜岃緭姘�23鍙锋车鏈夊姛鐢靛害" }, + { "_0402010201040102054", "浜岃緭姘�23鍙锋车鐢垫祦" }, + { "_0402010201090103003", "浜岃緭姘�23鍙锋车鐬椂娴侀噺" }, + { "_0402010201090103004", "浜岃緭姘�23鍙锋车绱娴侀噺" }, + { "_0402010201012399001", "浜岃緭姘�23鍙锋车杞��" }, + { "_0402010201010194135", "浜岃緭姘�23鍙锋车杩愯鐘舵��" }, + { "_0402010201040102217", "浜岃緭姘�23鍙锋车棰戠巼" }, + { "_0402010201090105003", "浜岃緭姘�2400绠″帇鍔�" }, + { "_0402010201090103017", "浜岃緭姘�2400绠$灛鏃舵祦閲�" }, + { "_0402010201090103018", "浜岃緭姘�2400绠$疮璁℃祦閲�" }, + { "_0402010201012405001", "浜岃緭姘�24鍙锋车鍑哄彛鍘嬪姏" }, + { "_0402010201040102057", "浜岃緭姘�24鍙锋车鏈夊姛鍔熺巼" }, + { "_0402010201040102149", "浜岃緭姘�24鍙锋车鏈夊姛鐢靛害" }, + { "_0402010201090103005", "浜岃緭姘�24鍙锋车鐬椂娴侀噺" }, + { "_0402010201090103006", "浜岃緭姘�24鍙锋车绱娴侀噺" }, + { "_0402010201012499001", "浜岃緭姘�24鍙锋车杞��" }, + { "_0402010201012401001", "浜岃緭姘�24鍙锋车杩愯鐘舵��" }, + { "_0402010201040102140", "浜岃緭姘�24鍙锋车棰戠巼" }, + { "_0402010201012505001", "浜岃緭姘�25鍙锋车鍑哄彛鍘嬪姏" }, + { "_0402010201040202004", "浜岃緭姘�25鍙锋车鏈夊姛鍔熺巼" }, + { "_0402010201040202141", "浜岃緭姘�25鍙锋车鏈夊姛鐢靛害" }, + { "_0402010201090103007", "浜岃緭姘�25鍙锋车鐬椂娴侀噺" }, + { "_0402010201090103008", "浜岃緭姘�25鍙锋车绱娴侀噺" }, + { "_0402010201012599001", "浜岃緭姘�25鍙锋车杞��" }, + { "_0402010201012501001", "浜岃緭姘�25鍙锋车杩愯鐘舵��" }, + { "_0402010201040202132", "浜岃緭姘�25鍙锋车棰戠巼" }, + { "_0402010201012605001", "浜岃緭姘�26鍙锋车鍑哄彛鍘嬪姏" }, + { "_0402010201040202006", "浜岃緭姘�26鍙锋车鏈夊姛鍔熺巼" }, + { "_0402010201040202028", "浜岃緭姘�26鍙锋车鏈夊姛鐢靛害" }, + { "_0402010201090103009", "浜岃緭姘�26鍙锋车鐬椂娴侀噺" }, + { "_0402010201090103010", "浜岃緭姘�26鍙锋车绱娴侀噺" }, + { "_0402010201012699001", "浜岃緭姘�26鍙锋车杞��" }, + { "_0402010201010194152", "浜岃緭姘�26鍙锋车杩愯鐘舵��" }, + { "_0402010201040202145", "浜岃緭姘�26鍙锋车棰戠巼" }, + { "_0402010201090105004", "浜岃緭姘�2700绠″帇鍔�" }, + { "_0402010201090194002", "浜岃緭姘�2700绠$灛鏃舵祦閲�" }, + { "_0402010201090194444", "浜岃緭姘�2700绠$疮璁℃祦閲�" }, + { "_0402010201012705001", "浜岃緭姘�27鍙锋车鍑哄彛鍘嬪姏" }, + { "_0402010201040202012", "浜岃緭姘�27鍙锋车鏈夊姛鍔熺巼" }, + { "_0402010201040202193", "浜岃緭姘�27鍙锋车鏈夊姛鐢靛害" }, + { "_0402010201090103903", "浜岃緭姘�27鍙锋车鐬椂娴侀噺" }, + { "_0402010201090194001", "浜岃緭姘�27鍙锋车绱娴侀噺" }, + { "_0402010201012799001", "浜岃緭姘�27鍙锋车杞��" }, + { "_0402010201012793021", "浜岃緭姘�27鍙锋车杩愯鐘舵��" }, + { "_0402010201040202184", "浜岃緭姘�27鍙锋车棰戠巼" }, + { "_0402010204089903001", "闄堣鍙栨按鍙i暱姹熸恫浣�" }, + { "_0402010201030103006", "闄堣姘村簱娑蹭綅" }, + }; + + var input = new ScadaDispatchInput(); + input.search = "history"; + input.starttime = startTime.ToString("G"); + input.endtime = endTime.ToString("G"); + input.Resolution = resolution.ToString(); + input.taglist = tagDict.Select(x => x.Key).ToArray(); + return input; + } + + + + //private async Task<ScadaDispatchOutput> GetRealScada(string flowId, ScadaDispatchInput input) + //{ + // if (input == null) + // { + // Log.Info(flowId, "ScadaDispatchInput is null"); + // return default; + // } + + // var ws = await CreateAsync("ws://localhost:5102/api/WebSocket/GetNotReadCount"); + // if (ws == null || ws.State != WebSocketState.Open) + // { + // Log.Info(flowId, "webSocket:杩炴帴澶辫触!"); + // return default; + // } + // Log.Info(flowId, "webSocket:杩炴帴鎴愬姛!"); + + // ScadaDispatchOutput output = null; + // var inputJson = JsonHelper.Object2FormatJson(input); + // Log.Debug(flowId, inputJson); + // var inputBytes = Encoding.UTF8.GetBytes(inputJson); + // await ws.SendAsync(inputBytes, WebSocketMessageType.Text, true, CancellationToken.None); + // try + // { + // var buffer = new ArraySegment<byte>(new byte[1024 * 4]); + // WebSocketReceiveResult result = null; + // using (var ms = new MemoryStream()) + // { + // do + // { + // result = await ws.ReceiveAsync(buffer, CancellationToken.None); + // ms.Write(buffer.Array, buffer.Offset, result.Count); + // } + // while (!result.EndOfMessage); + + // ms.Seek(0, SeekOrigin.Begin); + // if (result.MessageType == WebSocketMessageType.Text && !result.CloseStatus.HasValue) + // { + // using (var reader = new StreamReader(ms, Encoding.UTF8)) + // { + // string outputJson = reader.ReadToEnd(); + // output = new ScadaDispatchOutput(); + // output.Scadas = JsonHelper.Json2Object<Dictionary<string, Dictionary<DateTime, string>>>(outputJson); + // } + // } + // } + // } + // catch (Exception ex) + // { + // Log.Error(flowId, ex.Message); + // } + // finally + // { + // try + // { + // //鍏抽棴WebSocket + // await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "AcknowledgeCloseframe", CancellationToken.None); + // } + // catch (Exception ex) + // { + // Log.Error(flowId, "鍏抽棴WebSocket寮傚父", ex); + // } + // ws.Abort(); + // ws.Dispose(); + // } + + // return output; + //} + + ///// <summary> + ///// 鍒涘缓瀹㈡埛绔疄渚� + ///// </summary> + ///// <returns></returns> + //public static async Task<ClientWebSocket> CreateAsync(string ServerUri) + //{ + // var webSocket = new ClientWebSocket(); + // webSocket.Options.RemoteCertificateValidationCallback = delegate { return true; }; + + // await webSocket.ConnectAsync(new Uri(ServerUri), CancellationToken.None); + // if (webSocket.State == WebSocketState.Open) + // { + // return webSocket; + // } + // return null; + //} + + + } +} \ No newline at end of file diff --git a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/FactoryDispatchInput.cs "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/FactoryDispatchInput.cs" similarity index 100% rename from WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/FactoryDispatchInput.cs rename to "WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/FactoryDispatchInput.cs" diff --git "a/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/ScadaDispatchInput.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/ScadaDispatchInput.cs" new file mode 100644 index 0000000..587d5bb --- /dev/null +++ "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/ScadaDispatchInput.cs" @@ -0,0 +1,37 @@ +锘縩amespace IStation.Application +{ + /// <summary> + /// 瀹炴椂鏁版嵁璋冨害 + /// </summary> + public class ScadaDispatchInput + { + /// <summary> + /// + /// </summary> + public string search { get; set; } = "history"; + + /// <summary> + /// + /// </summary> + public string starttime { get; set; } + + /// <summary> + /// + /// </summary> + public string endtime { get; set; } + + /// <summary> + /// + /// </summary> + public string Resolution { get; set; } = "300"; + + /// <summary> + /// + /// </summary> + public string[] taglist { get; set; } + + + + + } +} diff --git "a/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/StationDispatchInput.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/StationDispatchInput.cs" new file mode 100644 index 0000000..a857f06 --- /dev/null +++ "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/input/StationDispatchInput.cs" @@ -0,0 +1,46 @@ +锘縩amespace IStation.Application +{ + /// <summary> + /// 娉电珯璋冨害 + /// </summary> + public class StationDispatchInput : IValidatableObject + { + /// <summary> + /// 璋冨害娴佺▼鏍囪瘑锛堟柟妗堣绠楀悗杩斿洖锛屽尯鍒嗚皟搴︽柟妗堢殑鍞竴鎬э級 + /// </summary> + public string FlowId { get; set; } + + /// <summary> + /// 姘村巶鍒楄〃 + /// </summary> + public List<FactoryDispatchInput> Factory { get; set; } + + /// <summary> + /// + /// </summary> + public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) + { + if (Factory == null || Factory.Count < 1) + { + yield return + new ValidationResult("Factory 涓嶈兘涓虹┖", new[] { nameof(Factory) }); + } + else + { + for (int i = 0; i < Factory.Count; i++) + { + var f = Factory[i]; + if (f.Value < 1) + { + yield return + new ValidationResult($"姘村巶澧炴按閲忚繃浣�! ID:{f.Id} Value:{f.Value}", new[] { nameof(Factory) }); + + } + } + } + + } + + + } +} diff --git a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/DispatchSolutionOutput.cs "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/DispatchSolutionOutput.cs" similarity index 100% rename from WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/DispatchSolutionOutput.cs rename to "WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/DispatchSolutionOutput.cs" diff --git a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/PumpDispatchOutput.cs "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/PumpDispatchOutput.cs" similarity index 100% rename from WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/PumpDispatchOutput.cs rename to "WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/PumpDispatchOutput.cs" diff --git "a/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/ScadaDispatchOutput.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/ScadaDispatchOutput.cs" new file mode 100644 index 0000000..cbb5dcb --- /dev/null +++ "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/ScadaDispatchOutput.cs" @@ -0,0 +1,15 @@ +锘縩amespace IStation.Application +{ + /// <summary> + /// 瀹炴椂鏁版嵁 + /// </summary> + public class ScadaDispatchOutput + { + + /// <summary> + /// + /// </summary> + public Dictionary<string, Dictionary<DateTime, string>> Scadas { get; set; } + + } +} diff --git "a/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/StationDispatchOutput.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/StationDispatchOutput.cs" new file mode 100644 index 0000000..576d0b5 --- /dev/null +++ "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/dto/output/StationDispatchOutput.cs" @@ -0,0 +1,75 @@ +锘縩amespace IStation.Application +{ + /// <summary> + /// 娉电珯璋冨害缁撴灉 + /// </summary> + public class StationDispatchOutput + { + /// <summary> + /// + /// </summary> + public StationDispatchOutput() { } + + /// <summary> + /// + /// </summary> + public StationDispatchOutput(StationDispatchOutput rhs) + { + this.Id = rhs.Id; + this.Index = rhs.Index; + this.Q = rhs.Q; + this.H = rhs.H; + this.E = rhs.E; + this.P = rhs.P; + this.WP = rhs.WP; + this.UWP = rhs.UWP; + this.Pumps = rhs.Pumps?.ToList(); + } + + /// <summary> + /// 娉电珯鏍囪瘑 + /// </summary> + public string Id { get; set; } + + /// <summary> + /// 娉电珯绱㈠紩 0锛氶檲琛�1杈撴按 1锛氶檲琛�2杈撴按 + /// </summary> + public int Index { get; set; } + + /// <summary> + /// 娴侀噺 m鲁/h + /// </summary> + public double Q { get; set; } + + /// <summary> + /// 鎵▼ m + /// </summary> + public double H { get; set; } + + /// <summary> + /// 鏁堢巼 % + /// </summary> + public double E { get; set; } + + /// <summary> + /// 鍔熺巼 kw + /// </summary> + public double P { get; set; } + + /// <summary> + /// 鍗冨惃姘磋兘鑰� kw/m.m3/h + /// </summary> + public double WP { get; set; } + + /// <summary> + /// 鍗曚綅鑳借�� kw/m3/h + /// </summary> + public double UWP { get; set; } + + /// <summary> + /// 娉靛垪琛� + /// </summary> + public List<PumpDispatchOutput> Pumps { get; set; } + + } +} diff --git "a/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/helper/ExternalPipeScada.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/helper/ExternalPipeScada.cs" new file mode 100644 index 0000000..898ad9d --- /dev/null +++ "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/helper/ExternalPipeScada.cs" @@ -0,0 +1,21 @@ +锘縩amespace IStation.Application +{ + + internal class ExternalPipeScada + { + public double JD1Flow { get; set; } + public double JD1Pressure { get; set; } + + public double JD2Flow { get; set; } + public double JD2Pressure { get; set; } + + public double JD3Flow { get; set; } + public double JD3Pressure { get; set; } + + public double DN2400Flow { get; set; } + public double DN2400Pressure { get; set; } + + public double DN2700Flow { get; set; } + public double DN2700Pressure { get; set; } + } +} diff --git "a/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/helper/TempOutHelper.cs" "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/helper/TempOutHelper.cs" new file mode 100644 index 0000000..3dca2c8 --- /dev/null +++ "b/WebApi/IStation.Application.Core/1-dispatch - \345\244\215\345\210\266/1-solution/helper/TempOutHelper.cs" @@ -0,0 +1,128 @@ +锘縰sing IStation.Common; + +namespace IStation.Application +{ + internal class TempOutHelper + { + + public static DispatchSolutionOutput GetDispatchSolutionOutput(string flowId) + { + var output = new DispatchSolutionOutput(); + output.SolutionId = "temp999"; + output.FlowId = flowId; + output.Station = new List<StationDispatchOutput>(); + + var chss1Pumps = new List<PumpDispatchOutput> + { + GetPumpDispatchOutput("Pump11", 0, true, 4307.7588, 15.8093, 81.6112, 227.219, 37.6271, 444), + GetPumpDispatchOutput("Pump12", 1, true, 4024.6057, 15.742, 81.3045, 212.1781, 36.523, 431), + GetPumpDispatchOutput("Pump13", 2, true, 3941.9631, 16.1554, 82.7758, 209.4876, 36.533, 431.1), + GetPumpDispatchOutput("Pump17", 6, true, 4130.7578, 15.9835, 82.6751, 217.4493, 36.6102, 432) + }; + + // var chss1totalH = 20.7518; + var chss1totalH = chss1Pumps.Average(x => x.H); + var chss1totalQ = chss1Pumps.Sum(x => x.Q); + var chss1totalP = chss1Pumps.Sum(x => x.P); + + var chss1totalE = PumpParaHelper.CalculateE(chss1totalQ, chss1totalH, chss1totalP); + var chss1 = GetStationDispatchOutput(1, chss1totalQ, chss1totalH, chss1totalE, chss1totalP, chss1Pumps); + + + var chss2Pumps = new List<PumpDispatchOutput> + { + GetPumpDispatchOutput("Pump22", 1, true, 9589.2422, 15.3166, 75.3, 533.233,33.4343, 331), + GetPumpDispatchOutput("Pump23", 2, true, 9423.4463, 15.1016, 72.4, 567.1, 34.4242, 340.8), + GetPumpDispatchOutput("Pump25", 4, true, 10226.1523, 15.0448, 72.4, 563.2, 34.3434, 340), + GetPumpDispatchOutput("Pump26", 5, true, 10011.1924, 15.1511, 74, 558.6, 33.9394, 336) + }; + + var chss2totalH = chss2Pumps.Average(x => x.H); + var chss2totalQ = chss2Pumps.Sum(x => x.Q); + var chss2totalP = chss2Pumps.Sum(x => x.P); + + var chss2totalE = PumpParaHelper.CalculateE(chss2totalQ, chss2totalH, chss2totalP); + var chss2 = GetStationDispatchOutput(2, chss2totalQ, chss2totalH, chss2totalE, chss2totalP, chss2Pumps); + + + output.Station.Add(chss1); + output.Station.Add(chss2); + return output; + } + + private static StationDispatchOutput GetStationDispatchOutput(int index, double q, double h, double e, double p, List<PumpDispatchOutput> pumps) + { + var model = new StationDispatchOutput(); + model.Id = index.ToString(); + model.Index = index; + model.Q = Math.Round(q, 1); + model.H = Math.Round(h, 1); + model.E = Math.Round(e, 1); + model.P = Math.Round(p, 1); + model.WP = Math.Round(Calcu_WP(p, q), 1); + model.UWP = Math.Round(Calcu_UWP(p, q, h), 1); + model.Pumps = pumps; + return model; + } + + + private static PumpDispatchOutput GetPumpDispatchOutput(string id, int index, bool isBp, double q, double h, double e, double p, double fre, double speed) + { + var model = new PumpDispatchOutput(); + model.Id = id; + model.Index = index; + model.Name = id; + model.IsBp = isBp; + model.Q = Math.Round(q, 1); + model.H = Math.Round(h, 1); + model.E = Math.Round(e, 1); + model.P = Math.Round(p, 1); + model.Frequency = Math.Round(fre, 1); + model.Speed = Math.Round(speed, 1); + return model; + } + + + /// <summary> + /// 鍗曚綅姘磋�� 鍗冨惃姘� + /// </summary> + private static double Calcu_UWP(double P, double Q, double H) + { + if (Q <= 0.001) + return 0; + if (H <= 0.00001) + return 0; + if (P <= 0.001) + return 0; + return P * 1000f / Q / H; + } + + /// <summary> + /// 鍗曚綅姘磋�� 鍗冨惃姘� + /// </summary> + private static double Calcu_UWP(double P, double Q, double inletPress, double outletPress) + { + double H = (outletPress - inletPress) * 102; + if (Q <= 0.001) + return 0; + if (H <= 0.00001) + return 0; + if (P <= 0.001) + return 0; + return P * 1000f / Q / H; + } + + /// <summary> + /// 鍗曚綅姘磋�� + /// </summary> + private static double Calcu_WP(double P, double Q) + { + if (Q <= 0.001) + return 0; + + if (P <= 0.001) + return 0; + return P * 1000f / Q; + } + } +} diff --git a/WebApi/IStation.Application.Core/1-dispatch/1-solution/DispatchSolution_Controller.cs b/WebApi/IStation.Application.Core/1-dispatch/1-solution/DispatchSolution_Controller.cs index 7380c86..2270f1d 100644 --- a/WebApi/IStation.Application.Core/1-dispatch/1-solution/DispatchSolution_Controller.cs +++ b/WebApi/IStation.Application.Core/1-dispatch/1-solution/DispatchSolution_Controller.cs @@ -1,4 +1,6 @@ -锘縩amespace IStation.Application +锘縰sing Yw.Calculation; + +namespace IStation.Application { /// <summary> /// 璋冨害鏂规 @@ -7,373 +9,161 @@ [ApiDescriptionSettings("Solution", Name = "闄堣璋冨害鏂规", Order = 1)] public class DispatchSolution_Controller : IDynamicApiController { - /// <summary> /// 璁$畻 /// </summary> [AllowAnonymous] [Route("Calculate@V1.0")] [HttpPost] - public async Task<DispatchSolutionOutput> Calculate([Required] StationDispatchInput input) + [NonUnify] + public async Task<StationDispatchOutput> Calculate([Required] StationDispatchInput input) { if (input == null) return null; - string flowId = input.FlowId; - Log.Debug(flowId, JsonHelper.Object2Json(input)); + var receipt_time = DateTime.Now; + Log.Debug(JsonHelper.Object2Json(input)); + //鑾峰彇Scada瀹炴椂鏁版嵁 + //...... - var scadaInput = GetScadaDispatchInput(DateTime.Now.AddSeconds(300), DateTime.Now); - var scadaOutput = await GetRealScada(flowId, scadaInput); - if (scadaOutput == null || scadaOutput.Scadas == null) + var total_flow1 = input.objects["TotalFlow1"]; + var total_pressure1 = input.objects["TotalPressure1"]; + total_pressure1 = Mpa2M(total_pressure1); + var total_flow2 = input.objects["TotalFlow2"]; + var total_pressure2 = input.objects["TotalPressure2"]; + total_pressure2 = Mpa2M(total_pressure2); + + var optimal_combine1 = GetOptimalCombine1(total_flow1, total_pressure1, null, null, null); + var optimal_combine2 = GetOptimalCombine2(total_flow2, total_pressure2, null, null, null); + + var output = new StationDispatchOutput(); + output.objects = new Dictionary<string, double>(); + if (optimal_combine1 == null && optimal_combine2 == null) { - Log.Info(flowId, "Scada:鏁版嵁鑾峰彇澶辫触锛岃皟搴︾粓姝�!"); - throw YOops.Oh(eResultCode.Error, InternalErrorCodes.L001, "Scada:鏁版嵁鑾峰彇澶辫触锛岃皟搴︾粓姝�!"); + output.flag = 0; + output.message = "鍦哄唴璋冨害鏂规鏃犳硶璁$畻!"; + Log.Info("璁$畻澶辫触锛氬満鍐呰皟搴︽柟妗堟棤娉曡绠�!"); } - - return TempOutHelper.GetDispatchSolutionOutput(input.FlowId); - } - - private async Task<ScadaDispatchOutput> GetRealScada(string flowId, ScadaDispatchInput input) - { - if (input == null) + else { - Log.Info(flowId, "ScadaDispatchInput is null"); - return default; - } - - var ws = new ClientWebSocket(); - ws.Options.RemoteCertificateValidationCallback = delegate { return true; }; - await ws.ConnectAsync(new Uri("ws://localhost:5102/api/WebSocket/GetNotReadCount"), CancellationToken.None); - if (ws.State != WebSocketState.Open) - { - Log.Info(flowId, "webSocket:杩炴帴澶辫触!"); - return default; - } - Log.Info(flowId, "webSocket:杩炴帴鎴愬姛!"); - - ScadaDispatchOutput output = null; - var inputJson = JsonHelper.Object2Json(input); - Log.Debug(flowId, inputJson); - var inputBytes = Encoding.UTF8.GetBytes(inputJson); - await ws.SendAsync(inputBytes, WebSocketMessageType.Text, true, CancellationToken.None); - try - { - List<byte> outputBytes = new List<byte>();//鍏ㄩ儴娑堟伅瀹瑰櫒 - var buffer = new byte[1024 * 4];//缂撳啿鍖� - var result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None); //鐩戝惉Socket淇℃伅 - while (!result.CloseStatus.HasValue) //鏄惁鍏抽棴 + if (optimal_combine1 != null) { - if (result.MessageType == WebSocketMessageType.Text)//鏂囨湰娑堟伅 + output.objects["1杈撴按鎬绘祦閲�"] = optimal_combine1.Flow; + output.objects["1杈撴按鎬诲帇鍔�"] = M2Mpa(optimal_combine1.Head); + foreach (var combine in optimal_combine1.Combines) { - outputBytes.AddRange(buffer.Take(result.Count)); - if (result.EndOfMessage)//娑堟伅鏄惁宸叉帴鏀跺畬鍏� + foreach (var pump_flag in combine.Flags) { - //鍙戦�佽繃鏉ョ殑娑堟伅 - string outputJson = Encoding.UTF8.GetString(outputBytes.ToArray(), 0, outputBytes.Count); - output = new ScadaDispatchOutput(); - output.Scadas = JsonHelper.Json2Object<Dictionary<string, Dictionary<DateTime, string>>>(outputJson); - break; + output.objects[$"1杈撴按{pump_flag}#棰戠巼"] = combine.Frequency; } } - result = await ws.ReceiveAsync(new ArraySegment<byte>(buffer), CancellationToken.None);//缁х画鐩戝惉Socket淇℃伅 } - } - catch (Exception ex) - { - Log.Error(flowId, ex.Message); - } - finally - { - try + if (optimal_combine2 != null) { - //鍏抽棴WebSocket - await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "AcknowledgeCloseframe", CancellationToken.None); + output.objects["2杈撴按鎬绘祦閲�"] = optimal_combine2.Flow; + output.objects["2杈撴按鎬诲帇鍔�"] = M2Mpa(optimal_combine2.Head); + foreach (var combine in optimal_combine2.Combines) + { + foreach (var pump_flag in combine.Flags) + { + output.objects[$"2杈撴按{pump_flag}#棰戠巼"] = combine.Frequency; + } + } } - catch (Exception ex) - { - Log.Error(flowId, "鍏抽棴WebSocket寮傚父", ex); - } - ws.Abort(); - ws.Dispose(); + output.flag = 1; + Log.Info("璁$畻鎴愬姛!"); } + output.ReceiptTime = receipt_time; + output.ReturnTime = DateTime.Now; return output; } - private ScadaDispatchInput GetScadaDispatchInput(DateTime startTime, DateTime endTime, double resolution = 300) + private string _data_floder = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Data"); + private List<IStation.Model.Pump> _station_pumps1 = null; + private List<IStation.Model.Pump> _station_pumps2 = null; + + /// <summary> + /// 鑾峰彇1杈撴按鏈�浼樿皟搴︽柟妗� + /// </summary> + /// <returns></returns> + IStation.Algorithm.OptimalCombine GetOptimalCombine1(double target_flow, double target_head, List<int> current_open_pump_flags, List<int> must_open_pump_flags, List<int> must_not_open_pump_flags) { - - var tagDict = new Dictionary<string, string> + if (_station_pumps1 == null) { - //{ "_0402010204089903001", "闀挎睙姘翠綅" }, - //{ "_0402010204089904009", "浜屽彇姘村墠姹犳恫浣�" }, - //{ "_0402010201030103006", "闄堣姘村簱姘翠綅" }, - //{ "_0402010204012101001", "浜屽彇姘�1鍙锋车鐘舵��" }, - //{ "_0402010204012201001", "浜屽彇姘�2鍙锋车鐘舵��" }, - //{ "_0402010204012301001", "浜屽彇姘�3鍙锋车鐘舵��" }, - //{ "_0402010204012401001", "浜屽彇姘�4鍙锋车鐘舵��" }, - //{ "_0402010204012501001", "浜屽彇姘�5鍙锋车鐘舵��" }, - //{ "_0402010204012103002", "浜屽彇姘�1鍙锋车绱娴侀噺" }, - //{ "_0402010204012203002", "浜屽彇姘�2鍙锋车绱娴侀噺" }, - //{ "_0402010204012303002", "浜屽彇姘�3鍙锋车绱娴侀噺" }, - //{ "_0402010204012403002", "浜屽彇姘�4鍙锋车绱娴侀噺" }, - //{ "_0402010204012503002", "浜屽彇姘�5鍙锋车绱娴侀噺" }, - //{ "_0402010204040193046", "浜屽彇姘�1鍙锋车鏈夊姛鐢佃兘" }, - //{ "_0402010204040193047", "浜屽彇姘�2鍙锋车鏈夊姛鐢佃兘" }, - //{ "_0402010204012308007", "浜屽彇姘�3鍙锋车鏈夊姛鐢佃兘" }, - //{ "_0402010204012408007", "浜屽彇姘�4鍙锋车鏈夊姛鐢佃兘" }, - //{ "_0402010204012508007", "浜屽彇姘�5鍙锋车鏈夊姛鐢佃兘" }, - { "_0402010201090105774", "涓�杈撴按11鍙峰嚭鍙e帇鍔�" }, - { "_0402010201040502031", "涓�杈撴按11鍙锋湁鍔熷姛鐜�" }, - { "_0402010201040502044", "涓�杈撴按11鍙锋湁鍔熺數搴�" }, - { "_0402010201011195062", "涓�杈撴按11鍙锋车杞��" }, - { "_0402010201011101001", "涓�杈撴按11鍙锋车杩愯鐘舵��" }, - { "_0402010201011194012", "涓�杈撴按11鍙锋车棰戠巼" }, - { "_0402010201090105005", "涓�杈撴按12鍙峰嚭鍙e帇鍔�" }, - { "_0402010201041402031", "涓�杈撴按12鍙锋湁鍔熷姛鐜�" }, - { "_0402010201041402044", "涓�杈撴按12鍙锋湁鍔熺數搴�" }, - { "_0402010201011295062", "涓�杈撴按12鍙锋车杞��" }, - { "_0402010201011201001", "涓�杈撴按12鍙锋车杩愯鐘舵��" }, - { "_0402010201011294012", "涓�杈撴按12鍙锋车棰戠巼" }, - { "_0402010201090105776", "涓�杈撴按13鍙峰嚭鍙e帇鍔�" }, - { "_0402010201040602031", "涓�杈撴按13鍙锋湁鍔熷姛鐜�" }, - { "_0402010201040602044", "涓�杈撴按13鍙锋湁鍔熺數搴�" }, - { "_0402010201011395062", "涓�杈撴按13鍙锋车杞��" }, - { "_0402010201011301001", "涓�杈撴按13鍙锋车杩愯鐘舵��" }, - { "_0402010201011394012", "涓�杈撴按13鍙锋车棰戠巼" }, - { "_0402010201090105007", "涓�杈撴按14鍙峰嚭鍙e帇鍔�" }, - { "_0402010201041302031", "涓�杈撴按14鍙锋湁鍔熷姛鐜�" }, - { "_0402010201041302044", "涓�杈撴按14鍙锋湁鍔熺數搴�" }, - { "_0402010201011495062", "涓�杈撴按14鍙锋车杞��" }, - { "_0402010201011401001", "涓�杈撴按14鍙锋车杩愯鐘舵��" }, - { "_0402010201011494012", "涓�杈撴按14鍙锋车棰戠巼" }, - { "_0402010201090105008", "涓�杈撴按15鍙峰嚭鍙e帇鍔�" }, - { "_0402010201040702031", "涓�杈撴按15鍙锋湁鍔熷姛鐜�" }, - { "_0402010201040702044", "涓�杈撴按15鍙锋湁鍔熺數搴�" }, - { "_0402010201011595062", "涓�杈撴按15鍙锋车杞��" }, - { "_0402010201011501003", "涓�杈撴按15鍙锋车杩愯鐘舵��" }, - { "_0402010201090105016", "涓�杈撴按16鍙峰嚭鍙e帇鍔�" }, - { "_0402010201041202031", "涓�杈撴按16鍙锋湁鍔熷姛鐜�" }, - { "_0402010201041202044", "涓�杈撴按16鍙锋湁鍔熺數搴�" }, - { "_0402010201011695062", "涓�杈撴按16鍙锋车杞��" }, - { "_0402010201011601003", "涓�杈撴按16鍙锋车杩愯鐘舵��" }, - { "_0402010201090105017", "涓�杈撴按17鍙峰嚭鍙e帇鍔�" }, - { "_0402010201040802031", "涓�杈撴按17鍙锋湁鍔熷姛鐜�" }, - { "_0402010201040802044", "涓�杈撴按17鍙锋湁鍔熺數搴�" }, - { "_0402010201011795062", "涓�杈撴按17鍙锋车杞��" }, - { "_0402010201011795056", "涓�杈撴按17鍙锋车杩愯鐘舵��" }, - { "_0402010201090105018", "涓�杈撴按18鍙峰嚭鍙e帇鍔�" }, - { "_0402010201041102031", "涓�杈撴按18鍙锋湁鍔熷姛鐜�" }, - { "_0402010201041102044", "涓�杈撴按18鍙锋湁鍔熺數搴�" }, - { "_0402010201011895062", "涓�杈撴按18鍙锋车杞��" }, - { "_0402010201011895056", "涓�杈撴按18鍙锋车杩愯鐘舵��" }, - { "_0402010201090104011", "涓�杈撴按鍓嶆睜娑蹭綅1" }, - { "_0402010201091104123", "涓�杈撴按鍓嶆睜娑蹭綅2" }, - { "_0402010201091104122", "涓�杈撴按鍓嶆睜娑蹭綅3" }, - { "_0402010201090105002", "涓�杈撴按鍢夊畾1绾垮帇鍔�" }, - { "_0402010201030191001", "涓�杈撴按鍢夊畾1绾跨灛鏃舵祦閲�" }, - { "_0402010201030191002", "涓�杈撴按鍢夊畾1绾跨疮璁℃祦閲�" }, - { "_0402010201090105011", "涓�杈撴按鍢夊畾2绾垮帇鍔�" }, - { "_0402010201090199011", "涓�杈撴按鍢夊畾2绾跨灛鏃舵祦閲�" }, - { "_0402010201090199012", "涓�杈撴按鍢夊畾2绾跨疮璁℃祦閲�" }, - { "_0402010201090105784", "涓�杈撴按鍢夊畾3绾垮帇鍔�" }, - { "_0402010201090199311", "涓�杈撴按鍢夊畾3绾跨灛鏃舵祦閲�" }, - { "_0402010201090199312", "涓�杈撴按鍢夊畾3绾跨疮璁℃祦閲�" }, - { "_0402010204012105001", "浜屽彇姘翠竴鍙锋満娉靛嚭鍙e帇鍔�" }, - { "_0402010204012101001", "浜屽彇姘翠竴鍙锋満娉靛紑鍋滅姸鎬�" }, - { "_0402010204040193004", "浜屽彇姘翠竴鍙锋満娉垫湁鍔熷姛鐜�" }, - { "_0402010204040193046", "浜屽彇姘翠竴鍙锋満娉垫湁鍔熺數搴�" }, - { "_0402010204012103001", "浜屽彇姘翠竴鍙锋満娉电灛鏃舵祦閲�" }, - { "_0402010204012103002", "浜屽彇姘翠竴鍙锋満娉电疮璁℃祦閲�" }, - { "_0402010204012305001", "浜屽彇姘翠笁鍙锋満娉靛嚭鍙e帇鍔�" }, - { "_0402010204012301001", "浜屽彇姘翠笁鍙锋満娉靛紑鍋滅姸鎬�" }, - { "_0402010204012308008", "浜屽彇姘翠笁鍙锋満娉垫湁鍔熷姛鐜�" }, - { "_0402010204012308007", "浜屽彇姘翠笁鍙锋満娉垫湁鍔熺數搴�" }, - { "_0402010204012303001", "浜屽彇姘翠笁鍙锋満娉电灛鏃舵祦閲�" }, - { "_0402010204012303002", "浜屽彇姘翠笁鍙锋満娉电疮璁℃祦閲�" }, - { "_0402010204012205001", "浜屽彇姘翠簩鍙锋満娉靛嚭鍙e帇鍔�" }, - { "_0402010204012201001", "浜屽彇姘翠簩鍙锋満娉靛紑鍋滅姸鎬�" }, - { "_0402010204040193005", "浜屽彇姘翠簩鍙锋満娉垫湁鍔熷姛鐜�" }, - { "_0402010204040193047", "浜屽彇姘翠簩鍙锋満娉垫湁鍔熺數搴�" }, - { "_0402010204012203001", "浜屽彇姘翠簩鍙锋満娉电灛鏃舵祦閲�" }, - { "_0402010204012203002", "浜屽彇姘翠簩鍙锋満娉电疮璁℃祦閲�" }, - { "_0402010204012505001", "浜屽彇姘翠簲鍙锋満娉靛嚭鍙e帇鍔�" }, - { "_0402010204012501001", "浜屽彇姘翠簲鍙锋満娉靛紑鍋滅姸鎬�" }, - { "_0402010204012508008", "浜屽彇姘翠簲鍙锋満娉垫湁鍔熷姛鐜�" }, - { "_0402010204012508007", "浜屽彇姘翠簲鍙锋満娉垫湁鍔熺數搴�" }, - { "_0402010204012503001", "浜屽彇姘翠簲鍙锋満娉电灛鏃舵祦閲�" }, - { "_0402010204012503002", "浜屽彇姘翠簲鍙锋満娉电疮璁℃祦閲�" }, - { "_0402010204089904009", "浜屽彇姘村墠姹犳恫浣�" }, - { "_0402010204012405001", "浜屽彇姘村洓鍙锋満娉靛嚭鍙e帇鍔�" }, - { "_0402010204012401001", "浜屽彇姘村洓鍙锋満娉靛紑鍋滅姸鎬�" }, - { "_0402010204012408008", "浜屽彇姘村洓鍙锋満娉垫湁鍔熷姛鐜�" }, - { "_0402010204012408007", "浜屽彇姘村洓鍙锋満娉垫湁鍔熺數搴�" }, - { "_0402010204012403001", "浜屽彇姘村洓鍙锋満娉电灛鏃舵祦閲�" }, - { "_0402010204012403002", "浜屽彇姘村洓鍙锋満娉电疮璁℃祦閲�" }, - { "_0402010201012105001", "浜岃緭姘�21鍙锋车鍑哄彛鍘嬪姏" }, - { "_0402010201040102049", "浜岃緭姘�21鍙锋车鏈夊姛鍔熺巼" }, - { "_0402010201040102187", "浜岃緭姘�21鍙锋车鏈夊姛鐢靛害" }, - { "_0402010201090103901", "浜岃緭姘�21鍙锋车鐬椂娴侀噺" }, - { "_0402010201010294045", "浜岃緭姘�21鍙锋车绱娴侀噺" }, - { "_0402010201012199001", "浜岃緭姘�21鍙锋车杞��" }, - { "_0402010201012193021", "浜岃緭姘�21鍙锋车杩愯鐘舵��" }, - { "_0402010201040102178", "浜岃緭姘�21鍙锋车棰戠巼" }, - { "_0402010201012205001", "浜岃緭姘�22鍙锋车鍑哄彛鍘嬪姏" }, - { "_0402010201040102053", "浜岃緭姘�22鍙锋车鏈夊姛鍔熺巼" }, - { "_0402010201040102213", "浜岃緭姘�22鍙锋车鏈夊姛鐢靛害" }, - { "_0402010201090103001", "浜岃緭姘�22鍙锋车鐬椂娴侀噺" }, - { "_0402010201090103002", "浜岃緭姘�22鍙锋车绱娴侀噺" }, - { "_0402010201012299001", "浜岃緭姘�22鍙锋车杞��" }, - { "_0402010201012201001", "浜岃緭姘�22鍙锋车杩愯鐘舵��" }, - { "_0402010201040102204", "浜岃緭姘�22鍙锋车棰戠巼" }, - { "_0402010201012305001", "浜岃緭姘�23鍙锋车鍑哄彛鍘嬪姏" }, - { "_0402010201040102055", "浜岃緭姘�23鍙锋车鏈夊姛鍔熺巼" }, - { "_0402010201040102136", "浜岃緭姘�23鍙锋车鏈夊姛鐢靛害" }, - { "_0402010201040102054", "浜岃緭姘�23鍙锋车鐢垫祦" }, - { "_0402010201090103003", "浜岃緭姘�23鍙锋车鐬椂娴侀噺" }, - { "_0402010201090103004", "浜岃緭姘�23鍙锋车绱娴侀噺" }, - { "_0402010201012399001", "浜岃緭姘�23鍙锋车杞��" }, - { "_0402010201010194135", "浜岃緭姘�23鍙锋车杩愯鐘舵��" }, - { "_0402010201040102217", "浜岃緭姘�23鍙锋车棰戠巼" }, - { "_0402010201090105003", "浜岃緭姘�2400绠″帇鍔�" }, - { "_0402010201090103017", "浜岃緭姘�2400绠$灛鏃舵祦閲�" }, - { "_0402010201090103018", "浜岃緭姘�2400绠$疮璁℃祦閲�" }, - { "_0402010201012405001", "浜岃緭姘�24鍙锋车鍑哄彛鍘嬪姏" }, - { "_0402010201040102057", "浜岃緭姘�24鍙锋车鏈夊姛鍔熺巼" }, - { "_0402010201040102149", "浜岃緭姘�24鍙锋车鏈夊姛鐢靛害" }, - { "_0402010201090103005", "浜岃緭姘�24鍙锋车鐬椂娴侀噺" }, - { "_0402010201090103006", "浜岃緭姘�24鍙锋车绱娴侀噺" }, - { "_0402010201012499001", "浜岃緭姘�24鍙锋车杞��" }, - { "_0402010201012401001", "浜岃緭姘�24鍙锋车杩愯鐘舵��" }, - { "_0402010201040102140", "浜岃緭姘�24鍙锋车棰戠巼" }, - { "_0402010201012505001", "浜岃緭姘�25鍙锋车鍑哄彛鍘嬪姏" }, - { "_0402010201040202004", "浜岃緭姘�25鍙锋车鏈夊姛鍔熺巼" }, - { "_0402010201040202141", "浜岃緭姘�25鍙锋车鏈夊姛鐢靛害" }, - { "_0402010201090103007", "浜岃緭姘�25鍙锋车鐬椂娴侀噺" }, - { "_0402010201090103008", "浜岃緭姘�25鍙锋车绱娴侀噺" }, - { "_0402010201012599001", "浜岃緭姘�25鍙锋车杞��" }, - { "_0402010201012501001", "浜岃緭姘�25鍙锋车杩愯鐘舵��" }, - { "_0402010201040202132", "浜岃緭姘�25鍙锋车棰戠巼" }, - { "_0402010201012605001", "浜岃緭姘�26鍙锋车鍑哄彛鍘嬪姏" }, - { "_0402010201040202006", "浜岃緭姘�26鍙锋车鏈夊姛鍔熺巼" }, - { "_0402010201040202028", "浜岃緭姘�26鍙锋车鏈夊姛鐢靛害" }, - { "_0402010201090103009", "浜岃緭姘�26鍙锋车鐬椂娴侀噺" }, - { "_0402010201090103010", "浜岃緭姘�26鍙锋车绱娴侀噺" }, - { "_0402010201012699001", "浜岃緭姘�26鍙锋车杞��" }, - { "_0402010201010194152", "浜岃緭姘�26鍙锋车杩愯鐘舵��" }, - { "_0402010201040202145", "浜岃緭姘�26鍙锋车棰戠巼" }, - { "_0402010201090105004", "浜岃緭姘�2700绠″帇鍔�" }, - { "_0402010201090194002", "浜岃緭姘�2700绠$灛鏃舵祦閲�" }, - { "_0402010201090194444", "浜岃緭姘�2700绠$疮璁℃祦閲�" }, - { "_0402010201012705001", "浜岃緭姘�27鍙锋车鍑哄彛鍘嬪姏" }, - { "_0402010201040202012", "浜岃緭姘�27鍙锋车鏈夊姛鍔熺巼" }, - { "_0402010201040202193", "浜岃緭姘�27鍙锋车鏈夊姛鐢靛害" }, - { "_0402010201090103903", "浜岃緭姘�27鍙锋车鐬椂娴侀噺" }, - { "_0402010201090194001", "浜岃緭姘�27鍙锋车绱娴侀噺" }, - { "_0402010201012799001", "浜岃緭姘�27鍙锋车杞��" }, - { "_0402010201012793021", "浜岃緭姘�27鍙锋车杩愯鐘舵��" }, - { "_0402010201040202184", "浜岃緭姘�27鍙锋车棰戠巼" }, - { "_0402010204089903001", "闄堣鍙栨按鍙i暱姹熸恫浣�" }, - { "_0402010201030103006", "闄堣姘村簱娑蹭綅" }, - }; + var filePath = _data_floder + "\\" + "闄堣涓�杈�.json"; + var jsonInfo = File.ReadAllText(filePath); + _station_pumps1 = JsonHelper.Json2Object<List<Model.Pump>>(jsonInfo); + if (_station_pumps1 == null) + { + Log.Error($"鏂囦欢缂哄け:{filePath}"); + return default; + } + } - var input = new ScadaDispatchInput(); - input.search = "history"; - input.starttime = startTime.ToString("G"); - input.endtime = endTime.ToString("G"); - input.Resolution = resolution.ToString(); - input.taglist = tagDict.Select(x => x.Key).ToArray(); - return input; + var flags_part1 = new List<int>() { 11, 12, 13, 14, 16, 17, 18 }; + var flags_part2 = new List<int>() { 15 }; + + var helper = new Algorithm.SchedulingHelper(); + var optimal_combine = helper.AnaOptimalCombine(_station_pumps1, flags_part1, flags_part2, target_flow, target_head, current_open_pump_flags, must_open_pump_flags, must_not_open_pump_flags); + if (optimal_combine == null) + { + Log.Error($"涓�杈撴按鏂规璁$畻澶辫触: optimal_combine1 is null"); + } + return optimal_combine; + } + + /// <summary> + /// 鑾峰彇2杈撴按鏈�浼樿皟搴︽柟妗� + /// </summary> + /// <returns></returns> + IStation.Algorithm.OptimalCombine GetOptimalCombine2(double target_flow, double target_head, List<int> current_open_pump_flags, List<int> must_open_pump_flags, List<int> must_not_open_pump_flags) + { + if (_station_pumps2 == null) + { + var filePath = _data_floder + "\\" + "闄堣浜岃緭.json"; + var jsonInfo = File.ReadAllText(filePath); + _station_pumps2 = JsonHelper.Json2Object<List<Model.Pump>>(jsonInfo); + if (_station_pumps2 == null) + { + Log.Error($"鏂囦欢缂哄け:{filePath}"); + return default; + } + } + + var flags_part1 = new List<int>() { 22, 23, 24, 25, 26 }; + var flags_part2 = new List<int>() { 21, 27 }; + + var helper = new Algorithm.SchedulingHelper(); + var optimal_combine = helper.AnaOptimalCombine(_station_pumps2, flags_part1, flags_part2, target_flow, target_head, current_open_pump_flags, must_open_pump_flags, must_not_open_pump_flags); + if (optimal_combine == null) + { + Log.Error($"浜岃緭姘存柟妗堣绠楀け璐�: optimal_combine1 is null"); + } + return optimal_combine; } + #region Mpa<=>m - //private async Task<ScadaDispatchOutput> GetRealScada(string flowId, ScadaDispatchInput input) - //{ - // if (input == null) - // { - // Log.Info(flowId, "ScadaDispatchInput is null"); - // return default; - // } + /// <summary> + /// Mpa=>m + /// </summary> + public static double Mpa2M(double mpa) + { + return mpa * ConstantParas.WaterDensity / ConstantParas.g; + } - // var ws = await CreateAsync("ws://localhost:5102/api/WebSocket/GetNotReadCount"); - // if (ws == null || ws.State != WebSocketState.Open) - // { - // Log.Info(flowId, "webSocket:杩炴帴澶辫触!"); - // return default; - // } - // Log.Info(flowId, "webSocket:杩炴帴鎴愬姛!"); + /// <summary> + /// m=>Mpa + /// </summary> + public static double M2Mpa(double m) + { + return m * ConstantParas.g / ConstantParas.WaterDensity; + } - // ScadaDispatchOutput output = null; - // var inputJson = JsonHelper.Object2FormatJson(input); - // Log.Debug(flowId, inputJson); - // var inputBytes = Encoding.UTF8.GetBytes(inputJson); - // await ws.SendAsync(inputBytes, WebSocketMessageType.Text, true, CancellationToken.None); - // try - // { - // var buffer = new ArraySegment<byte>(new byte[1024 * 4]); - // WebSocketReceiveResult result = null; - // using (var ms = new MemoryStream()) - // { - // do - // { - // result = await ws.ReceiveAsync(buffer, CancellationToken.None); - // ms.Write(buffer.Array, buffer.Offset, result.Count); - // } - // while (!result.EndOfMessage); - - // ms.Seek(0, SeekOrigin.Begin); - // if (result.MessageType == WebSocketMessageType.Text && !result.CloseStatus.HasValue) - // { - // using (var reader = new StreamReader(ms, Encoding.UTF8)) - // { - // string outputJson = reader.ReadToEnd(); - // output = new ScadaDispatchOutput(); - // output.Scadas = JsonHelper.Json2Object<Dictionary<string, Dictionary<DateTime, string>>>(outputJson); - // } - // } - // } - // } - // catch (Exception ex) - // { - // Log.Error(flowId, ex.Message); - // } - // finally - // { - // try - // { - // //鍏抽棴WebSocket - // await ws.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "AcknowledgeCloseframe", CancellationToken.None); - // } - // catch (Exception ex) - // { - // Log.Error(flowId, "鍏抽棴WebSocket寮傚父", ex); - // } - // ws.Abort(); - // ws.Dispose(); - // } - - // return output; - //} - - ///// <summary> - ///// 鍒涘缓瀹㈡埛绔疄渚� - ///// </summary> - ///// <returns></returns> - //public static async Task<ClientWebSocket> CreateAsync(string ServerUri) - //{ - // var webSocket = new ClientWebSocket(); - // webSocket.Options.RemoteCertificateValidationCallback = delegate { return true; }; - - // await webSocket.ConnectAsync(new Uri(ServerUri), CancellationToken.None); - // if (webSocket.State == WebSocketState.Open) - // { - // return webSocket; - // } - // return null; - //} - + #endregion } } \ No newline at end of file diff --git a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/ScadaDispatchInput.cs b/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/ScadaDispatchInput.cs index cd35c7a..587d5bb 100644 --- a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/ScadaDispatchInput.cs +++ b/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/ScadaDispatchInput.cs @@ -31,13 +31,7 @@ public string[] taglist { get; set; } - /// <summary> - /// 鑷姩鐢熸垚 - /// </summary> - public void AutoCreate() - { - var list = new List<string>(); - } + } } diff --git a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/StationDispatchInput.cs b/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/StationDispatchInput.cs index a857f06..fd59122 100644 --- a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/StationDispatchInput.cs +++ b/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/input/StationDispatchInput.cs @@ -6,39 +6,105 @@ public class StationDispatchInput : IValidatableObject { /// <summary> - /// 璋冨害娴佺▼鏍囪瘑锛堟柟妗堣绠楀悗杩斿洖锛屽尯鍒嗚皟搴︽柟妗堢殑鍞竴鎬э級 + /// 瀵硅薄鍒楄〃 /// </summary> - public string FlowId { get; set; } + public Dictionary<string, double> objects { get; set; } /// <summary> - /// 姘村巶鍒楄〃 + /// 璁$畻鐘舵�� 0:澶辫触 1:鎴愬姛 /// </summary> - public List<FactoryDispatchInput> Factory { get; set; } + public int flag { get; set; } /// <summary> - /// + /// 鎺ユ敹鏃堕棿 + /// </summary> + public DateTime ReceiptTime { get; set; } + + /// <summary> + /// 杩斿洖鏃堕棿 + /// </summary> + public DateTime ReturnTime { get; set; } + + /// <summary> + /// 澶囨敞淇℃伅 + /// </summary> + public string message { get; set; } + + + /// <summary> + /// 楠岃瘉 /// </summary> public IEnumerable<ValidationResult> Validate(ValidationContext validationContext) { - if (Factory == null || Factory.Count < 1) + if (objects == null || objects.Count < 1) { yield return - new ValidationResult("Factory 涓嶈兘涓虹┖", new[] { nameof(Factory) }); + new ValidationResult("objects 涓嶈兘涓虹┖", new[] { nameof(objects) }); + } + else if (objects.Count < 4) + { + yield return + new ValidationResult("objects 鏁版嵁缂哄け", new[] { nameof(objects) }); } else { - for (int i = 0; i < Factory.Count; i++) + if (!objects.ContainsKey("TotalFlow1")) { - var f = Factory[i]; - if (f.Value < 1) + yield return + new ValidationResult(" objects [TotalFlow1]鏁版嵁缂哄け", new[] { nameof(objects) }); + } + else + { + if (objects["TotalFlow1"] < 1) { yield return - new ValidationResult($"姘村巶澧炴按閲忚繃浣�! ID:{f.Id} Value:{f.Value}", new[] { nameof(Factory) }); + new ValidationResult($"涓�杈撴按澧炴按閲忚繃浣�! tag:TotalFlow1 Value:{objects["TotalFlow1"]}", new[] { nameof(objects) }); + } + } + if (!objects.ContainsKey("TotalPressure1")) + { + yield return + new ValidationResult(" objects [TotalPressure1]鏁版嵁缂哄け", new[] { nameof(objects) }); + } + else + { + if (objects["TotalPressure1"] < 0.01) + { + yield return + new ValidationResult($"涓�杈撴按澧炲帇杩囦綆! tag:TotalPressure1 Value:{objects["TotalPressure1"]}", new[] { nameof(objects) }); + } + } + + if (!objects.ContainsKey("TotalFlow2")) + { + yield return + new ValidationResult(" objects [TotalFlow2]鏁版嵁缂哄け", new[] { nameof(objects) }); + } + else + { + if (objects["TotalFlow2"] < 1) + { + yield return + new ValidationResult($"浜岃緭姘村姘撮噺杩囦綆! tag:TotalFlow2 Value:{objects["TotalFlow2"]}", new[] { nameof(objects) }); + } + } + + + if (!objects.ContainsKey("TotalPressure2")) + { + yield return + new ValidationResult(" objects [TotalPressure2]鏁版嵁缂哄け", new[] { nameof(objects) }); + } + else + { + if (objects["TotalPressure2"] < 0.01) + { + yield return + new ValidationResult($"浜岃緭姘村鍘嬭繃浣�! tag:TotalPressure2 Value:{objects["TotalPressure2"]}", new[] { nameof(objects) }); } } } - } diff --git a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/StationDispatchOutput.cs b/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/StationDispatchOutput.cs index 576d0b5..68b59a5 100644 --- a/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/StationDispatchOutput.cs +++ b/WebApi/IStation.Application.Core/1-dispatch/1-solution/dto/output/StationDispatchOutput.cs @@ -11,65 +11,29 @@ public StationDispatchOutput() { } /// <summary> - /// + /// 瀵硅薄鍒楄〃 /// </summary> - public StationDispatchOutput(StationDispatchOutput rhs) - { - this.Id = rhs.Id; - this.Index = rhs.Index; - this.Q = rhs.Q; - this.H = rhs.H; - this.E = rhs.E; - this.P = rhs.P; - this.WP = rhs.WP; - this.UWP = rhs.UWP; - this.Pumps = rhs.Pumps?.ToList(); - } + public Dictionary<string, double> objects { get; set; } /// <summary> - /// 娉电珯鏍囪瘑 + /// 璁$畻鐘舵�� 0:澶辫触 1:鎴愬姛 /// </summary> - public string Id { get; set; } + public int flag { get; set; } /// <summary> - /// 娉电珯绱㈠紩 0锛氶檲琛�1杈撴按 1锛氶檲琛�2杈撴按 + /// 鎺ユ敹鏃堕棿 /// </summary> - public int Index { get; set; } + public DateTime ReceiptTime { get; set; } /// <summary> - /// 娴侀噺 m鲁/h + /// 杩斿洖鏃堕棿 /// </summary> - public double Q { get; set; } + public DateTime ReturnTime { get; set; } /// <summary> - /// 鎵▼ m + /// 澶囨敞淇℃伅 /// </summary> - public double H { get; set; } - - /// <summary> - /// 鏁堢巼 % - /// </summary> - public double E { get; set; } - - /// <summary> - /// 鍔熺巼 kw - /// </summary> - public double P { get; set; } - - /// <summary> - /// 鍗冨惃姘磋兘鑰� kw/m.m3/h - /// </summary> - public double WP { get; set; } - - /// <summary> - /// 鍗曚綅鑳借�� kw/m3/h - /// </summary> - public double UWP { get; set; } - - /// <summary> - /// 娉靛垪琛� - /// </summary> - public List<PumpDispatchOutput> Pumps { get; set; } + public string message { get; set; } } } diff --git a/WebApi/IStation.Application.Core/IStation.Application.Core.csproj b/WebApi/IStation.Application.Core/IStation.Application.Core.csproj index b8e6053..831df00 100644 --- a/WebApi/IStation.Application.Core/IStation.Application.Core.csproj +++ b/WebApi/IStation.Application.Core/IStation.Application.Core.csproj @@ -11,7 +11,18 @@ </PropertyGroup> <ItemGroup> + <Compile Remove="1-dispatch - 澶嶅埗\**" /> + <EmbeddedResource Remove="1-dispatch - 澶嶅埗\**" /> + <None Remove="1-dispatch - 澶嶅埗\**" /> + </ItemGroup> + + <ItemGroup> + <Compile Remove="0-core\3-helper\Log - 澶嶅埗.cs" /> <Compile Remove="1-dispatch\1-solution\DispatchSolution_Controller - 澶嶅埗.cs" /> + <Compile Remove="1-dispatch\1-solution\dto\input\FactoryDispatchInput.cs" /> + <Compile Remove="1-dispatch\1-solution\dto\output\DispatchSolutionOutput.cs" /> + <Compile Remove="1-dispatch\1-solution\dto\output\PumpDispatchOutput.cs" /> + <Compile Remove="1-dispatch\1-solution\helper\TempOutHelper.cs" /> </ItemGroup> <ItemGroup> @@ -48,10 +59,11 @@ <ItemGroup> <PackageReference Include="Yw.Application.Core" Version="3.0.5" /> - <PackageReference Include="Yw.Quartz.Core" Version="1.0.0" /> + <PackageReference Include="Yw.Quartz.Core" Version="3.0.0" /> </ItemGroup> <ItemGroup> + <ProjectReference Include="..\..\Schedule\IStation.Algorithm\IStation.Algorithm.csproj" /> <ProjectReference Include="..\IStation.Server\IStation.Server.csproj" /> <ProjectReference Include="..\IStation.Service.Core\IStation.Service.Core.csproj" /> </ItemGroup> diff --git a/WebApi/IStation.Entry.Core/IStation.Entry.Core.csproj.user b/WebApi/IStation.Entry.Core/IStation.Entry.Core.csproj.user new file mode 100644 index 0000000..ffbfc12 --- /dev/null +++ b/WebApi/IStation.Entry.Core/IStation.Entry.Core.csproj.user @@ -0,0 +1,6 @@ +锘�<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup> + <NameOfLastUsedPublishProfile>D:\WorkCode\IStation\Code\Service.Ch.V1.0\WebApi\IStation.Entry.Core\Properties\PublishProfiles\FolderProfile.pubxml</NameOfLastUsedPublishProfile> + </PropertyGroup> +</Project> \ No newline at end of file diff --git a/WebApi/IStation.Entry.Core/Properties/PublishProfiles/FolderProfile.pubxml.user b/WebApi/IStation.Entry.Core/Properties/PublishProfiles/FolderProfile.pubxml.user index d42c8a1..1fab1bc 100644 --- a/WebApi/IStation.Entry.Core/Properties/PublishProfiles/FolderProfile.pubxml.user +++ b/WebApi/IStation.Entry.Core/Properties/PublishProfiles/FolderProfile.pubxml.user @@ -4,7 +4,8 @@ --> <Project> <PropertyGroup> - <_PublishTargetUrl>D:\WorkData\妯″潡\鏉冮檺\Yw.Entry.Core\bin\Release\net6.0\publish\</_PublishTargetUrl> - <History>True|2023-06-26T03:38:29.6648988Z;True|2023-06-21T16:17:40.6226554+08:00;True|2023-06-21T13:30:18.8163322+08:00;True|2023-06-21T13:19:43.9290154+08:00;True|2023-06-21T11:35:28.3376504+08:00;</History> + <_PublishTargetUrl>D:\WorkCode\IStation\Code\Service.Ch.V1.0\WebApi\IStation.Entry.Core\bin\Release\net6.0\publish\</_PublishTargetUrl> + <History>True|2024-05-07T02:48:01.6650551Z;True|2024-05-07T10:33:33.1990927+08:00;True|2024-05-07T10:20:40.5715968+08:00;False|2024-05-07T10:20:22.6825823+08:00;False|2024-05-07T10:19:44.6799744+08:00;True|2023-06-26T11:38:29.6648988+08:00;True|2023-06-21T16:17:40.6226554+08:00;True|2023-06-21T13:30:18.8163322+08:00;True|2023-06-21T13:19:43.9290154+08:00;True|2023-06-21T11:35:28.3376504+08:00;</History> + <LastFailureDetails /> </PropertyGroup> </Project> \ No newline at end of file diff --git a/WebApi/IStation.Service.Core/GlobalUsings.cs b/WebApi/IStation.Service.Core/GlobalUsings.cs index c4b177b..ed8bfc6 100644 --- a/WebApi/IStation.Service.Core/GlobalUsings.cs +++ b/WebApi/IStation.Service.Core/GlobalUsings.cs @@ -1,5 +1,2 @@ -锘縢lobal using SqlSugar; -global using Yw.Untity; -global using System.Text; -global using IStation.Epanet.Enums; +锘縢lobal using System.Text; global using Yw; \ No newline at end of file diff --git a/WebApi/IStation.Service.Core/IStation.Service.Core.csproj b/WebApi/IStation.Service.Core/IStation.Service.Core.csproj index d5c0ce2..bdbc9bc 100644 --- a/WebApi/IStation.Service.Core/IStation.Service.Core.csproj +++ b/WebApi/IStation.Service.Core/IStation.Service.Core.csproj @@ -12,12 +12,21 @@ </PropertyGroup> <ItemGroup> - <Compile Remove="4-dal\1-dispatch_solution\**" /> - <Compile Remove="6-service\1-dispatch_solution\**" /> - <EmbeddedResource Remove="4-dal\1-dispatch_solution\**" /> - <EmbeddedResource Remove="6-service\1-dispatch_solution\**" /> - <None Remove="4-dal\1-dispatch_solution\**" /> - <None Remove="6-service\1-dispatch_solution\**" /> + <Compile Remove="2-model\**" /> + <Compile Remove="4-dal\**" /> + <Compile Remove="5-cache\**" /> + <Compile Remove="6-service\**" /> + <Compile Remove="7-utils\**" /> + <EmbeddedResource Remove="2-model\**" /> + <EmbeddedResource Remove="4-dal\**" /> + <EmbeddedResource Remove="5-cache\**" /> + <EmbeddedResource Remove="6-service\**" /> + <EmbeddedResource Remove="7-utils\**" /> + <None Remove="2-model\**" /> + <None Remove="4-dal\**" /> + <None Remove="5-cache\**" /> + <None Remove="6-service\**" /> + <None Remove="7-utils\**" /> </ItemGroup> <ItemGroup> -- Gitblit v1.9.3