From e9fad702d50cf9c7c98c774d0673b363a2b7bee2 Mon Sep 17 00:00:00 2001
From: MoYue <18168119590@163.com>
Date: Thu, 11 Apr 2024 17:49:43 +0800
Subject: [PATCH] =?UTF-8?q?=E6=97=B6=E5=BA=8F=E9=85=8D=E7=BD=AE=E6=A0=A1?=
=?UTF-8?q?=E9=AA=8C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
InSituLaboratory.IService/IDeviceSvice.cs | 7 +
.../ISysSequentialService.cs | 12 ++
.../SysSequentialService.cs | 22 +++
.../Dialogs/ModifySequentialViewModel.cs | 133 ++++++++++++++----
.../Pages/SequentialDistributionView.xaml | 2 +
5 files changed, 151 insertions(+), 25 deletions(-)
diff --git a/InSituLaboratory.IService/IDeviceSvice.cs b/InSituLaboratory.IService/IDeviceSvice.cs
index eb2a77b..5d49bcc 100644
--- a/InSituLaboratory.IService/IDeviceSvice.cs
+++ b/InSituLaboratory.IService/IDeviceSvice.cs
@@ -15,6 +15,13 @@ namespace InSituLaboratory.IService
///
IEnumerable GetDevices();
+ ///
+ /// 根据设备名称获取设备ID
+ ///
+ ///
+ ///
string GetDeviceByDeviceName(string DeviceName);
+
+
}
}
diff --git a/InSituLaboratory.IService/ISysSequentialService.cs b/InSituLaboratory.IService/ISysSequentialService.cs
index 93e071f..477921e 100644
--- a/InSituLaboratory.IService/ISysSequentialService.cs
+++ b/InSituLaboratory.IService/ISysSequentialService.cs
@@ -33,5 +33,17 @@ namespace InSituLaboratory.IService
///
IEnumerable GetSequentialDetailList(int key);
+
+
+ ///
+ /// 根据序组、时序号查询循环时间
+ ///
+ ///
+ ///
+ ///
+ ///
+ SysSequentialDetails GetSequentialSequenceGroup(string SequenceGroup,string Sequential);
+
+
}
}
diff --git a/InSituLaboratory.Service/SysSequentialService.cs b/InSituLaboratory.Service/SysSequentialService.cs
index 00704ab..6048b22 100644
--- a/InSituLaboratory.Service/SysSequentialService.cs
+++ b/InSituLaboratory.Service/SysSequentialService.cs
@@ -43,5 +43,27 @@ namespace InSituLaboratory.Service
{
return this.Set().Where(m => m.Number == key && m.IsDelete == 0);
}
+
+
+ ///
+ /// 根据序组、时序号查询循环时间
+ ///
+ ///
+ ///
+ ///
+ ///
+ public SysSequentialDetails GetSequentialSequenceGroup(string SequenceGroup, string Sequential)
+ {
+ var list = this.Query(m => m.SequenceGroup == SequenceGroup && m.Sequential == Sequential && m.IsDelete == 0).ToList();
+ if (list.Count == 0)
+ {
+ return null;
+ }
+ else
+ {
+ return list.FirstOrDefault();
+ }
+
+ }
}
}
diff --git a/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs b/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs
index fe70be7..7c643bb 100644
--- a/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs
+++ b/InSituLaboratory/ViewModels/Pages/Dialogs/ModifySequentialViewModel.cs
@@ -25,6 +25,9 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
///
public List DeviceNodes { get; set; } = new List();
+ public SysSequentialDetails SysSequentialdata { get; set; }
+
+
public string? workTime { get; set; }
public long? workInt { get; set; }
@@ -43,7 +46,26 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
///
/// 配置
///
- public string SequenceGroup { get; set; }
+ private string _sequenceGroup;
+
+ public string SequenceGroup
+ {
+ get { return _sequenceGroup; }
+ set
+ {
+ _sequenceGroup = value;
+ SysSequentialdata = _sequentialService.GetSequentialSequenceGroup(SequenceGroup, kind);
+ if (SysSequentialdata != null)
+ {
+ ErrorList.Add("DurationTime", new List { "当前配置存在循环时长:" + SysSequentialdata.DurationTime +"s"});
+ }
+ else
+ {
+ ErrorList.Remove("DurationTime");
+ }
+ this.RaiseErrorsChanged("DurationTime");
+ }
+ }
///
/// 序号
@@ -57,9 +79,9 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
public string SensorID
{
- get { return _sensorID;}
- set
- {
+ get { return _sensorID; }
+ set
+ {
_sensorID = value;
//通过设备信息查询设备工作时长
workTime = _deviceSvice.GetDeviceByDeviceName(_sensorID);
@@ -71,12 +93,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(WorkTime) > workInt)
{
ErrorList.Add("WorkTime", new List { "质谱仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
}
else
{
ErrorList.Remove("WorkTime");
- this.RaiseErrorsChanged("WorkTime");
}
}
else if (_sensorID == "二氧化碳同位素分析仪")
@@ -85,12 +105,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(WorkTime) > workInt)
{
ErrorList.Add("WorkTime", new List { "二氧化碳同位素分析仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
}
else
{
ErrorList.Remove("WorkTime");
- this.RaiseErrorsChanged("WorkTime");
}
}
else if (_sensorID == "甲烷同位素分析仪")
@@ -99,7 +117,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(WorkTime) > workInt)
{
ErrorList.Add("WorkTime", new List { "甲烷同位素分析仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else if (_sensorID == "气相色谱仪")
@@ -108,7 +129,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(WorkTime) > workInt)
{
ErrorList.Add("WorkTime", new List { "气相色谱仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else if (_sensorID == "基因测序仪")
@@ -117,23 +141,50 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(WorkTime) > workInt)
{
ErrorList.Add("WorkTime", new List { "基因测序仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else
{
ErrorList.Remove("WorkTime");
- this.RaiseErrorsChanged("WorkTime");
}
-
+ this.RaiseErrorsChanged("WorkTime");
}
}
-
///
/// 循环时长
///
- public string DurationTime { get; set; }
+ private string _durationTime;
+
+ public string DurationTime
+ {
+ get { return _durationTime; }
+ set
+ {
+ _durationTime = value;
+ ErrorList.Remove("DurationTime");
+ if (SequenceGroup != null)
+ {
+ if (SysSequentialdata != null)
+ {
+ if (_durationTime != SysSequentialdata.DurationTime)
+ {
+ ErrorList.Add("DurationTime", new List { "当前配置已存在循环时长:" + SysSequentialdata.DurationTime +"s"+",无法修改" });
+ }
+ else
+ {
+ ErrorList.Remove("DurationTime");
+ }
+ this.RaiseErrorsChanged("DurationTime");
+ }
+ }
+ }
+ }
+
///
/// 时序类别
@@ -148,14 +199,13 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
public string WorkTime
{
get { return _workTime; }
- set
+ set
{
_workTime = value;
this.ErrorList.Clear();
if (string.IsNullOrEmpty(value))
{
ErrorList.Add("WorkTime", new List { "工作时长不能为空" });
- this.RaiseErrorsChanged();
}
else if (_sensorID == "质谱仪")
{
@@ -163,7 +213,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(value) > workInt)
{
ErrorList.Add("WorkTime", new List { "质谱仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else if (_sensorID == "二氧化碳同位素分析仪")
@@ -172,7 +225,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(value) > workInt)
{
ErrorList.Add("WorkTime", new List { "二氧化碳同位素分析仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else if (_sensorID == "甲烷同位素分析仪")
@@ -181,7 +237,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(value) > workInt)
{
ErrorList.Add("WorkTime", new List { "甲烷同位素分析仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else if (_sensorID == "气相色谱仪")
@@ -190,7 +249,10 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(value) > workInt)
{
ErrorList.Add("WorkTime", new List { "气相色谱仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else if (_sensorID == "基因测序仪")
@@ -199,14 +261,18 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
if (Convert.ToInt64(value) > workInt)
{
ErrorList.Add("WorkTime", new List { "基因测序仪已超出最大工作时长" });
- this.RaiseErrorsChanged("WorkTime");
+ }
+ else
+ {
+ ErrorList.Remove("WorkTime");
}
}
else
{
ErrorList.Remove("WorkTime");
- this.RaiseErrorsChanged("WorkTime");
}
+ this.RaiseErrorsChanged("WorkTime");
+
}
}
@@ -227,7 +293,7 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
startTime = parameters.GetValue("sequentialStartTime");
endTime = parameters.GetValue("sequentialEndTime");
kind = parameters.GetValue("kind");
-
+
if (SequentialDetail == null)
{
@@ -240,6 +306,8 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
var su = _sequentialService.Find(SequentialDetail.Number);
Number = su.Number;
SensorID = su.SensorID;
+ WorkTime = su.WorkTime;
+ SequenceGroup = su.SequenceGroup;
DurationTime = su.DurationTime;
}
@@ -250,6 +318,15 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
{
try
{
+ if (SysSequentialdata != null)
+ {
+ if (SysSequentialdata.DurationTime == DurationTime)
+ {
+ ErrorList.Remove("DurationTime");
+ this.RaiseErrorsChanged("DurationTime");
+ }
+ }
+
if (this.HasErrors) return;
var data = _sequentialService.GetSequentials(kind).ToList();
@@ -270,6 +347,8 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
SysSquentialID = Squential.Number,
SensorID = SensorID,
DurationTime = DurationTime,
+ WorkTime = WorkTime,
+ SequenceGroup = SequenceGroup,
CreateTime = DateTime.Now,
Sequential = kind,
IsDelete = 0
@@ -302,6 +381,8 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
var ssd = _sequentialService.Find(Number);
ssd.SensorID = SensorID;
ssd.DurationTime = DurationTime;
+ ssd.WorkTime = WorkTime;
+ ssd.SequenceGroup = SequenceGroup;
_sequentialService.Update(ssd);
}
}
@@ -322,6 +403,8 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
SysSquentialID = Squential.Number,
SensorID = SensorID,
DurationTime = DurationTime,
+ WorkTime = WorkTime,
+ SequenceGroup = SequenceGroup,
CreateTime = DateTime.Now,
Sequential = kind,
IsDelete = 0
@@ -329,7 +412,7 @@ namespace InSituLaboratory.ViewModels.Pages.Dialogs
}
}
-
+
base.DoSave();
}
diff --git a/InSituLaboratory/Views/Pages/SequentialDistributionView.xaml b/InSituLaboratory/Views/Pages/SequentialDistributionView.xaml
index d9561fb..a33cdaa 100644
--- a/InSituLaboratory/Views/Pages/SequentialDistributionView.xaml
+++ b/InSituLaboratory/Views/Pages/SequentialDistributionView.xaml
@@ -154,6 +154,8 @@
+
+