commit 1c1766158fdb529893e45b2d3597acc60aa7cf3d Author: LiuShaoming Date: Mon Jan 26 21:51:40 2026 +0800 上传文件至「/」 diff --git a/AlarmContentService.cs b/AlarmContentService.cs new file mode 100644 index 0000000..1442b69 --- /dev/null +++ b/AlarmContentService.cs @@ -0,0 +1,26 @@ +using Cowain.Bake.Model; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Unity; + +namespace Cowain.Bake.BLL +{ + public class AlarmContentService : ServiceBase + { + public AlarmContentService(IUnityContainer unityContainer) : base(unityContainer) + { + } + + public List GetAll() + { + using (var Context = new BakingEntities()) + { + return (from c in Context.Set() + select c).ToList(); + } + } + } +} diff --git a/AlarmService.cs b/AlarmService.cs new file mode 100644 index 0000000..17b1bb5 --- /dev/null +++ b/AlarmService.cs @@ -0,0 +1,108 @@ +using Cowain.Bake.Common.Enums; +using Cowain.Bake.Model; +using Cowain.Bake.Model.Models; +using System; +using System.Collections.Generic; +using System.Data; +using System.Data.Entity; +using System.Linq; +using System.Runtime.Remoting.Contexts; +using System.Text; +using System.Threading.Tasks; +using Unity; + +namespace Cowain.Bake.BLL +{ + public class AlarmService : ServiceBase + { + public AlarmService(IUnityContainer unityContainer) : base(unityContainer) + { + } + + public TAlarm GetInAlarm(Variable node, string desc) + { + using (var Context = new BakingEntities()) + { + return (from a in Context.Set() + where a.Desc == desc + && a.StationId == node.StationId + && a.StopTime == null + select a).FirstOrDefault(); + } + } + + public TAlarm GetInAlarm(int tagId) + { + using (var Context = new BakingEntities()) + { + return (from a in Context.Set() + where a.TagId == tagId && a.StopTime == null + select a).FirstOrDefault(); + } + } + + + public List GetInAlarms() + { + using (var Context = new BakingEntities()) + { + return (from a in Context.Set() + where a.StopTime == null + select a).ToList(); + } + } + + public int CancelAlarm(TAlarm alarm) + { + + alarm.Status = EAlarmStatus.Renew.GetDescription(); + alarm.StopTime = DateTime.Now; + + using (var Context = new BakingEntities()) + { + Context.Set().Attach(alarm);//将数据附加到上下文,支持实体修改和新实体,重置为UnChanged + Context.Entry(alarm).State = EntityState.Modified; + return Context.SaveChanges(); + } + } + + //一个信号报警 + public int Insert(TAlarm alarm) + { + using (var Context = new BakingEntities()) + { + Context.Set().Add(alarm); + return Context.SaveChanges(); + } + } + public List GetAlarmReport(string startTime, string endTime) + { + DateTime startDateTime = DateTime.Parse(startTime + " 00:00:01"); + DateTime endDateTime = DateTime.Parse(endTime + " 23:59:59"); + using (var Context = new BakingEntities()) + { + return (from a in Context.Set() + where a.StartTime >= startDateTime + && a.StartTime <= endDateTime + select a).OrderByDescending(x => x.StartTime).ToList(); + } + } + + public int Insert(Variable node, string desc) + { + TAlarm model = new TAlarm() + { + Desc = desc, + StationId = node.StationId, + StartTime = DateTime.Now, + Status = EAlarmStatus.Alert.GetDescription() + }; + + using (var Context = new BakingEntities()) + { + Context.Set().Add(model); + return Context.SaveChanges(); + } + } + } +} diff --git a/App.config b/App.config new file mode 100644 index 0000000..ed8e25d --- /dev/null +++ b/App.config @@ -0,0 +1,29 @@ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Cowain.Bake.sln b/Cowain.Bake.sln new file mode 100644 index 0000000..e5d9dff --- /dev/null +++ b/Cowain.Bake.sln @@ -0,0 +1,80 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.32228.343 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Main", "Cowain.Bake.Main\Cowain.Bake.Main.csproj", "{8E1456EF-EDF6-4DC3-BF95-62655997D912}" + ProjectSection(ProjectDependencies) = postProject + {09EF460A-9D14-4090-B0D5-CA43E4B72A66} = {09EF460A-9D14-4090-B0D5-CA43E4B72A66} + {152AAF38-8F84-4EBB-93C0-15C71C2B85EB} = {152AAF38-8F84-4EBB-93C0-15C71C2B85EB} + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} + {3D24095D-B703-438D-AB17-C6BD7E9EF514} = {3D24095D-B703-438D-AB17-C6BD7E9EF514} + {362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Common", "Cowain.Bake.Common\Cowain.Bake.Common.csproj", "{4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}" + ProjectSection(ProjectDependencies) = postProject + {362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Model", "Cowain.Bake.Model\Cowain.Bake.Model.csproj", "{362F196C-7C59-4DFB-9A3E-85F880791312}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.UI", "Cowain.Bake.UI\Cowain.Bake.UI.csproj", "{09EF460A-9D14-4090-B0D5-CA43E4B72A66}" + ProjectSection(ProjectDependencies) = postProject + {152AAF38-8F84-4EBB-93C0-15C71C2B85EB} = {152AAF38-8F84-4EBB-93C0-15C71C2B85EB} + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} + {3D24095D-B703-438D-AB17-C6BD7E9EF514} = {3D24095D-B703-438D-AB17-C6BD7E9EF514} + {362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.BLL", "Cowain.Bake.BLL\Cowain.Bake.BLL.csproj", "{3D24095D-B703-438D-AB17-C6BD7E9EF514}" + ProjectSection(ProjectDependencies) = postProject + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} + {362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312} + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cowain.Bake.Communication", "Cowain.Bake.Communication\Cowain.Bake.Communication.csproj", "{152AAF38-8F84-4EBB-93C0-15C71C2B85EB}" + ProjectSection(ProjectDependencies) = postProject + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} = {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4} + {3D24095D-B703-438D-AB17-C6BD7E9EF514} = {3D24095D-B703-438D-AB17-C6BD7E9EF514} + {362F196C-7C59-4DFB-9A3E-85F880791312} = {362F196C-7C59-4DFB-9A3E-85F880791312} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8E1456EF-EDF6-4DC3-BF95-62655997D912}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E1456EF-EDF6-4DC3-BF95-62655997D912}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E1456EF-EDF6-4DC3-BF95-62655997D912}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E1456EF-EDF6-4DC3-BF95-62655997D912}.Release|Any CPU.Build.0 = Release|Any CPU + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4E1A0D39-34EF-498D-A3A7-D1489C6A6FE4}.Release|Any CPU.Build.0 = Release|Any CPU + {362F196C-7C59-4DFB-9A3E-85F880791312}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {362F196C-7C59-4DFB-9A3E-85F880791312}.Debug|Any CPU.Build.0 = Debug|Any CPU + {362F196C-7C59-4DFB-9A3E-85F880791312}.Release|Any CPU.ActiveCfg = Release|Any CPU + {362F196C-7C59-4DFB-9A3E-85F880791312}.Release|Any CPU.Build.0 = Release|Any CPU + {09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Debug|Any CPU.Build.0 = Debug|Any CPU + {09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Release|Any CPU.ActiveCfg = Release|Any CPU + {09EF460A-9D14-4090-B0D5-CA43E4B72A66}.Release|Any CPU.Build.0 = Release|Any CPU + {3D24095D-B703-438D-AB17-C6BD7E9EF514}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D24095D-B703-438D-AB17-C6BD7E9EF514}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D24095D-B703-438D-AB17-C6BD7E9EF514}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D24095D-B703-438D-AB17-C6BD7E9EF514}.Release|Any CPU.Build.0 = Release|Any CPU + {152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {152AAF38-8F84-4EBB-93C0-15C71C2B85EB}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A1A7434F-D795-4316-AE65-571C8FCE6F55} + EndGlobalSection +EndGlobal diff --git a/README.md b/README.md new file mode 100644 index 0000000..353f11d --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +### 3248-001上位机 +兴旺达手动烤箱上位机 \ No newline at end of file