编写计算设备功耗是否超总功耗及设备运行时长是否超时的功能
This commit is contained in:
parent
9f2387b551
commit
fd091e4f3f
@ -178,6 +178,9 @@ namespace InSituLaboratory.Common
|
|||||||
currentSequentiual.Sequentiual1Status = "不存在时序";
|
currentSequentiual.Sequentiual1Status = "不存在时序";
|
||||||
break;
|
break;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
|
currentSequentiual.Sequentiual1Status = "时序状态变更交替中";
|
||||||
|
break;
|
||||||
|
case 0x06:
|
||||||
currentSequentiual.Sequentiual1Status = "异常";
|
currentSequentiual.Sequentiual1Status = "异常";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@ -937,24 +937,40 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
opendata += data[i];
|
opendata += data[i];
|
||||||
opendata = opendata + "、";
|
opendata = opendata + "、";
|
||||||
}
|
}
|
||||||
if (System.Windows.Forms.MessageBox.Show("当前处于打开状态的设备有" + opendata + "确认需要一键还原吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
DialogResult s1= System.Windows.Forms.MessageBox.Show("当前处于打开状态的设备有" + opendata + "确认需要一键还原且进行强制关闭吗?", "警告", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
|
if (s1 == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
if (System.Windows.Forms.MessageBox.Show("再次确定需要一键还原吗?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK)
|
//消息体
|
||||||
{
|
//强制关闭
|
||||||
//消息体
|
byte[] byteaq = new byte[] { 0x93, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01 };
|
||||||
byte[] byteaq = new byte[] { 0x93, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00 };
|
|
||||||
|
|
||||||
List<byte> buffer = Escape(byteaq);
|
List<byte> buffer = Escape(byteaq);
|
||||||
string list = tools.byteToHexStr(buffer.ToArray());
|
string list = tools.byteToHexStr(buffer.ToArray());
|
||||||
byte[] bytea = tools.ConvertHexStringToBytes(list);
|
byte[] bytea = tools.ConvertHexStringToBytes(list);
|
||||||
clientModel.SendData(bytea);
|
clientModel.SendData(bytea);
|
||||||
|
|
||||||
logModel = new LogModel();
|
logModel = new LogModel();
|
||||||
logModel.CreateTime = DateTime.Now;
|
logModel.CreateTime = DateTime.Now;
|
||||||
logModel.Remark = "一键还原指令已下发";
|
logModel.Remark = "一键还原指令已下发";
|
||||||
_logService.Insert<LogModel>(logModel);
|
_logService.Insert<LogModel>(logModel);
|
||||||
this.Refresh();
|
this.Refresh();
|
||||||
}
|
|
||||||
|
}
|
||||||
|
else if (s1 == DialogResult.No)
|
||||||
|
{
|
||||||
|
//非强制关闭
|
||||||
|
byte[] byteaq = new byte[] { 0x93, 0x00, 0x10, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
||||||
|
|
||||||
|
List<byte> buffer = Escape(byteaq);
|
||||||
|
string list = tools.byteToHexStr(buffer.ToArray());
|
||||||
|
byte[] bytea = tools.ConvertHexStringToBytes(list);
|
||||||
|
clientModel.SendData(bytea);
|
||||||
|
|
||||||
|
logModel = new LogModel();
|
||||||
|
logModel.CreateTime = DateTime.Now;
|
||||||
|
logModel.Remark = "一键还原指令已下发";
|
||||||
|
_logService.Insert<LogModel>(logModel);
|
||||||
|
this.Refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -964,6 +980,7 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
logModel.CreateTime = DateTime.Now;
|
logModel.CreateTime = DateTime.Now;
|
||||||
logModel.Remark = "服务端未连接";
|
logModel.Remark = "服务端未连接";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -16,6 +16,7 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using System.Windows.Markup;
|
||||||
|
|
||||||
namespace InSituLaboratory.ViewModels.Pages
|
namespace InSituLaboratory.ViewModels.Pages
|
||||||
{
|
{
|
||||||
@ -115,46 +116,97 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
/// <param name="model"></param>
|
/// <param name="model"></param>
|
||||||
public override void DoModifyS1(object model)
|
public override void DoModifyS1(object model)
|
||||||
{
|
{
|
||||||
|
var status = "";
|
||||||
|
var datalist1 = _sysSequentialService.Query<SysSequential>(m => m.StartTime == sequentStatusModel.SequentialStartTime1 && m.EndTime == sequentStatusModel.SequentialEndTime1 && m.IsDelete == 0 && m.Sequential == "时序1").ToList();
|
||||||
if (sequentStatusModel.SequentialStartTime1 == null || sequentStatusModel.SequentialEndTime1 == null)
|
if (sequentStatusModel.SequentialStartTime1 == null || sequentStatusModel.SequentialEndTime1 == null)
|
||||||
{
|
{
|
||||||
System.Windows.Forms.MessageBox.Show("时序1: 开始时间和结束时间不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("时序1: 开始时间和结束时间不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DateTime expirationDate = (DateTime)sequentStatusModel.SequentialStartTime1;
|
if (datalist1.Count() != 0)
|
||||||
DateTime expirationDate1 = (DateTime)sequentStatusModel.SequentialEndTime1;
|
{
|
||||||
DateTime dateTime = DateTime.Now;
|
foreach (var item in datalist1)
|
||||||
|
{
|
||||||
|
status = item.Status;
|
||||||
|
}
|
||||||
|
if (status == "已生成未下发")
|
||||||
|
{
|
||||||
|
DateTime expirationDate = (DateTime)sequentStatusModel.SequentialStartTime1;
|
||||||
|
DateTime expirationDate1 = (DateTime)sequentStatusModel.SequentialEndTime1;
|
||||||
|
DateTime dateTime = DateTime.Now;
|
||||||
|
|
||||||
if (expirationDate < dateTime)
|
if (expirationDate < dateTime)
|
||||||
{
|
{
|
||||||
System.Windows.Forms.MessageBox.Show("时序1: 开始时间不得早于当前时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("时序1: 开始时间不得早于当前时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
}
|
}
|
||||||
else if (expirationDate1 < dateTime)
|
else if (expirationDate1 < dateTime)
|
||||||
{
|
{
|
||||||
System.Windows.Forms.MessageBox.Show("时序1: 结束时间不得早于当前时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("时序1: 结束时间不得早于当前时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
}
|
}
|
||||||
else if (expirationDate >= expirationDate1)
|
else if (expirationDate >= expirationDate1)
|
||||||
{
|
{
|
||||||
System.Windows.Forms.MessageBox.Show("时序1: 结束时间不得早于开始时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("时序1: 结束时间不得早于开始时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DialogParameters ps = new DialogParameters();
|
||||||
|
ps.Add("model", model);
|
||||||
|
ps.Add("sequentialStartTime", sequentStatusModel.SequentialStartTime1);
|
||||||
|
ps.Add("sequentialEndTime", sequentStatusModel.SequentialEndTime1);
|
||||||
|
ps.Add("kind", "时序1");
|
||||||
|
_dialogService.ShowDialog("ModifySequentialView", ps, result =>
|
||||||
|
{
|
||||||
|
// 判断子窗口的返回状态,如果OK,刷新当前页面,否则不管
|
||||||
|
if (result.Result == ButtonResult.OK)
|
||||||
|
{
|
||||||
|
this.RefreshS1();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.Forms.MessageBox.Show(" 当前时序已下发!!! \n 若要设置新的时序,您可以修改时序的开始时间和结束时间即可!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DialogParameters ps = new DialogParameters();
|
DateTime expirationDate = (DateTime)sequentStatusModel.SequentialStartTime1;
|
||||||
ps.Add("model", model);
|
DateTime expirationDate1 = (DateTime)sequentStatusModel.SequentialEndTime1;
|
||||||
ps.Add("sequentialStartTime", sequentStatusModel.SequentialStartTime1);
|
DateTime dateTime = DateTime.Now;
|
||||||
ps.Add("sequentialEndTime", sequentStatusModel.SequentialEndTime1);
|
|
||||||
ps.Add("kind", "时序1");
|
if (expirationDate < dateTime)
|
||||||
_dialogService.ShowDialog("ModifySequentialView", ps, result =>
|
|
||||||
{
|
{
|
||||||
// 判断子窗口的返回状态,如果OK,刷新当前页面,否则不管
|
System.Windows.Forms.MessageBox.Show("时序1: 开始时间不得早于当前时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
if (result.Result == ButtonResult.OK)
|
}
|
||||||
|
else if (expirationDate1 < dateTime)
|
||||||
|
{
|
||||||
|
System.Windows.Forms.MessageBox.Show("时序1: 结束时间不得早于当前时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
else if (expirationDate >= expirationDate1)
|
||||||
|
{
|
||||||
|
System.Windows.Forms.MessageBox.Show("时序1: 结束时间不得早于开始时间!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DialogParameters ps = new DialogParameters();
|
||||||
|
ps.Add("model", model);
|
||||||
|
ps.Add("sequentialStartTime", sequentStatusModel.SequentialStartTime1);
|
||||||
|
ps.Add("sequentialEndTime", sequentStatusModel.SequentialEndTime1);
|
||||||
|
ps.Add("kind", "时序1");
|
||||||
|
_dialogService.ShowDialog("ModifySequentialView", ps, result =>
|
||||||
{
|
{
|
||||||
this.RefreshS1();
|
// 判断子窗口的返回状态,如果OK,刷新当前页面,否则不管
|
||||||
}
|
if (result.Result == ButtonResult.OK)
|
||||||
});
|
{
|
||||||
|
this.RefreshS1();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -165,30 +217,43 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (System.Windows.Forms.MessageBox.Show("是否确定删除此项?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
|
var status = "";
|
||||||
|
var datalist1 = _sysSequentialService.Query<SysSequential>(m => m.StartTime == sequentStatusModel.SequentialStartTime1 && m.EndTime == sequentStatusModel.SequentialEndTime1 && m.IsDelete == 0 && m.Sequential == "时序1").ToList();
|
||||||
|
foreach (var item in datalist1)
|
||||||
{
|
{
|
||||||
// 软删除
|
status += item.Status;
|
||||||
var data = _sysSequentialService.Find<SysSequentialDetails>((model as SysSequentialDetails).Number);
|
}
|
||||||
data.IsDelete = 1;
|
if (status == "已生成未下发")
|
||||||
_sysSequentialService.Update(data);
|
{
|
||||||
|
if (System.Windows.Forms.MessageBox.Show("是否确定删除此项?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK)
|
||||||
//查询删除后子表是否还存在时序配置
|
|
||||||
var list = _sysSequentialService.GetSequentialDetails(data.SysSquentialID).ToList();
|
|
||||||
//若子表不存在当前时序下配置信息,则删除对应的母表时序
|
|
||||||
if (list.Count() == 0)
|
|
||||||
{
|
{
|
||||||
var SysSequential = _sysSequentialService.Find<SysSequential>(data.SysSquentialID);
|
// 软删除
|
||||||
SysSequential.IsDelete = 1;
|
var data = _sysSequentialService.Find<SysSequentialDetails>((model as SysSequentialDetails).Number);
|
||||||
_sysSequentialService.Update(SysSequential);
|
data.IsDelete = 1;
|
||||||
|
_sysSequentialService.Update(data);
|
||||||
|
|
||||||
|
//查询删除后子表是否还存在时序配置
|
||||||
|
var list = _sysSequentialService.GetSequentialDetails(data.SysSquentialID).ToList();
|
||||||
|
//若子表不存在当前时序下配置信息,则删除对应的母表时序
|
||||||
|
if (list.Count() == 0)
|
||||||
|
{
|
||||||
|
var SysSequential = _sysSequentialService.Find<SysSequential>(data.SysSquentialID);
|
||||||
|
SysSequential.IsDelete = 1;
|
||||||
|
_sysSequentialService.Update(SysSequential);
|
||||||
|
}
|
||||||
|
|
||||||
|
///更新时序总表
|
||||||
|
var data1 = _sysSequentialService.Find<SysSequentialTotal>((model as SysSequentialDetails).Number);
|
||||||
|
data1.IsDelete = 1;
|
||||||
|
_sysSequentialService.Update(data1);
|
||||||
|
|
||||||
|
System.Windows.Forms.MessageBox.Show("删除完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
||||||
|
this.RefreshS1();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
///更新时序总表
|
else
|
||||||
var data1 = _sysSequentialService.Find<SysSequentialTotal>((model as SysSequentialDetails).Number);
|
{
|
||||||
data1.IsDelete = 1;
|
System.Windows.Forms.MessageBox.Show(" 当前时序已下发!!! \n 无法删除!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
_sysSequentialService.Update(data1);
|
|
||||||
|
|
||||||
System.Windows.Forms.MessageBox.Show("删除完成!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
|
|
||||||
this.RefreshS1();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@ -203,21 +268,70 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void SendS1()
|
public override void SendS1()
|
||||||
{
|
{
|
||||||
|
var status = "";
|
||||||
|
var datalist1 = _sysSequentialService.Query<SysSequential>(m => m.StartTime == sequentStatusModel.SequentialStartTime1 && m.EndTime == sequentStatusModel.SequentialEndTime1 && m.IsDelete == 0 && m.Sequential == "时序1").ToList();
|
||||||
|
|
||||||
if (sequentStatusModel.SequentialStartTime1 == null || sequentStatusModel.SequentialEndTime1 == null)
|
if (sequentStatusModel.SequentialStartTime1 == null || sequentStatusModel.SequentialEndTime1 == null)
|
||||||
{
|
{
|
||||||
System.Windows.Forms.MessageBox.Show("时序1: 开始时间和结束时间不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("时序1: 开始时间和结束时间不能为空!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
}
|
}
|
||||||
|
else if (datalist1.Count() == 0)
|
||||||
|
{
|
||||||
|
System.Windows.Forms.MessageBox.Show("时序1中未有设备,无法下发!!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
||||||
{
|
{
|
||||||
List<byte> byteaq = encode((DateTime)sequentStatusModel.SequentialStartTime1, (DateTime)sequentStatusModel.SequentialEndTime1, 0x01, "时序1");
|
DateTime startTime = (DateTime)sequentStatusModel.SequentialStartTime1;
|
||||||
List<byte> buffer = Escape(byteaq.ToArray());
|
DateTime endTime = (DateTime)sequentStatusModel.SequentialEndTime1;
|
||||||
string list = tools.byteToHexStr(buffer.ToArray());
|
foreach (var item in datalist1)
|
||||||
byte[] bytea = tools.ConvertHexStringToBytes(list);
|
{
|
||||||
RelayViewModel.clientModel.SendData(bytea);
|
status = item.Status;
|
||||||
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
}
|
||||||
|
if (status == "已生成未下发")
|
||||||
|
{
|
||||||
|
System.Windows.Forms.DialogResult s1 = System.Windows.Forms.MessageBox.Show("是否修改并等待当前工作设备工作完最短周期后生效新时序? \n若选择否,则修改且关闭该时序所有设备!!!", "警告", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
|
|
||||||
|
//修改并等待当前工作设备工作完最短周期后生效新时序
|
||||||
|
if (s1 == System.Windows.Forms.DialogResult.Yes)
|
||||||
|
{
|
||||||
|
//计算设备功耗是否超总功耗及设备运行时长是否超时
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
List<byte> byteaq = encode(startTime, endTime, 0x01, "时序1");
|
||||||
|
List<byte> buffer = Escape(byteaq.ToArray());
|
||||||
|
string list = tools.byteToHexStr(buffer.ToArray());
|
||||||
|
byte[] bytea = tools.ConvertHexStringToBytes(list);
|
||||||
|
RelayViewModel.clientModel.SendData(bytea);
|
||||||
|
|
||||||
|
//更新时序母表及时序总表状态字段
|
||||||
|
UpdateData(startTime, endTime, "时序1", "已下发");
|
||||||
|
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
//修改且关闭该时序所有设备
|
||||||
|
else if (s1 == System.Windows.Forms.DialogResult.No)
|
||||||
|
{
|
||||||
|
//计算设备功耗是否超总功耗及设备运行时长是否超时
|
||||||
|
|
||||||
|
|
||||||
|
List<byte> byteaq = encode((DateTime)sequentStatusModel.SequentialStartTime1, (DateTime)sequentStatusModel.SequentialEndTime1, 0x02, "时序1");
|
||||||
|
List<byte> buffer = Escape(byteaq.ToArray());
|
||||||
|
string list = tools.byteToHexStr(buffer.ToArray());
|
||||||
|
byte[] bytea = tools.ConvertHexStringToBytes(list);
|
||||||
|
RelayViewModel.clientModel.SendData(bytea);
|
||||||
|
|
||||||
|
//更新时序母表及时序总表状态字段
|
||||||
|
UpdateData(startTime, endTime, "时序1", "已下发");
|
||||||
|
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
System.Windows.Forms.MessageBox.Show("当前时序已下发!!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
}
|
||||||
|
this.RefreshS1();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -239,8 +353,27 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
{
|
{
|
||||||
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
||||||
{
|
{
|
||||||
dosend(0x01, 0x02);
|
DateTime startTime = (DateTime)sequentStatusModel.SequentialStartTime1;
|
||||||
|
DateTime endTime = (DateTime)sequentStatusModel.SequentialEndTime1;
|
||||||
|
|
||||||
|
System.Windows.Forms.DialogResult s1 = System.Windows.Forms.MessageBox.Show("是否清空并等待当前工作设备工作完最短周期? \n若选择否,则清空且关闭该时序所有设备!!!", "警告", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
|
|
||||||
|
//清空并等待当前工作设备工作完最短周期
|
||||||
|
if (s1 == System.Windows.Forms.DialogResult.Yes)
|
||||||
|
{
|
||||||
|
dosend(0x01, 0x03);
|
||||||
|
//更新时序母表及时序总表状态字段
|
||||||
|
UpdateData(startTime, endTime, "时序1", "已清空并等待");
|
||||||
|
}
|
||||||
|
//清空且关闭该时序所有设备
|
||||||
|
else if (s1 == System.Windows.Forms.DialogResult.No)
|
||||||
|
{
|
||||||
|
dosend(0x01, 0x04);
|
||||||
|
//更新时序母表及时序总表状态字段
|
||||||
|
UpdateData(startTime, endTime, "时序1", "已清空并关闭");
|
||||||
|
}
|
||||||
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
this.RefreshS1();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -262,8 +395,14 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
{
|
{
|
||||||
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
||||||
{
|
{
|
||||||
dosend(0x01, 0x03);
|
DateTime startTime = (DateTime)sequentStatusModel.SequentialStartTime1;
|
||||||
|
DateTime endTime = (DateTime)sequentStatusModel.SequentialEndTime1;
|
||||||
|
dosend(0x01, 0x05);
|
||||||
|
|
||||||
|
//更新时序母表及时序总表状态字段
|
||||||
|
UpdateData(startTime, endTime, "时序1", "已启动");
|
||||||
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
this.RefreshS1();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -285,8 +424,27 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
{
|
{
|
||||||
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
if (RelayViewModel.SocketInfo.ConnectionMessage == "断开")
|
||||||
{
|
{
|
||||||
dosend(0x01, 0x04);
|
DateTime startTime = (DateTime)sequentStatusModel.SequentialStartTime1;
|
||||||
|
DateTime endTime = (DateTime)sequentStatusModel.SequentialEndTime1;
|
||||||
|
|
||||||
|
System.Windows.Forms.DialogResult s1 = System.Windows.Forms.MessageBox.Show("是否暂停并等待当前工作设备工作完最短周期? \n若选择否,则暂停且关闭该时序所有设备!!!", "警告", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
|
||||||
|
|
||||||
|
//暂停并等待当前工作设备工作完最短周期
|
||||||
|
if (s1 == System.Windows.Forms.DialogResult.Yes)
|
||||||
|
{
|
||||||
|
dosend(0x01, 0x07);
|
||||||
|
//更新时序母表及时序总表状态字段
|
||||||
|
UpdateData(startTime, endTime, "时序1", "已暂停并等待");
|
||||||
|
}
|
||||||
|
//暂停且关闭该时序所有设备
|
||||||
|
else if (s1 == System.Windows.Forms.DialogResult.No)
|
||||||
|
{
|
||||||
|
dosend(0x01, 0x08);
|
||||||
|
//更新时序母表及时序总表状态字段
|
||||||
|
UpdateData(startTime, endTime, "时序1", "已暂停并关闭");
|
||||||
|
}
|
||||||
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
System.Windows.Forms.MessageBox.Show("命令已下发!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
|
||||||
|
this.RefreshS1();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1343,5 +1501,34 @@ namespace InSituLaboratory.ViewModels.Pages
|
|||||||
}
|
}
|
||||||
return byteaq;
|
return byteaq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 更新时序母表及时序总表状态字段
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="StartTime">时序开始时间</param>
|
||||||
|
/// <param name="EndTime">时序结束时间</param>
|
||||||
|
/// <param name="kind">时序号</param>
|
||||||
|
/// <param name="action">更新内容</param>
|
||||||
|
public void UpdateData(DateTime StartTime, DateTime EndTime, string kind, string action)
|
||||||
|
{
|
||||||
|
var datalist = _sysSequentialService.Query<SysSequentialTotal>(m => m.StartTime == StartTime && m.EndTime == EndTime && m.IsDelete == 0 && m.Sequential == kind).OrderBy(n => n.SequenceGroup).ThenBy(s => s.CreateTime).ToArray();
|
||||||
|
|
||||||
|
//更新时序总表状态字段 已生成未下发 -> action
|
||||||
|
foreach (var item in datalist)
|
||||||
|
{
|
||||||
|
var data = _sysSequentialService.Find<SysSequentialTotal>(item.ID);
|
||||||
|
data.Status = action;
|
||||||
|
_sysSequentialService.Update(data);
|
||||||
|
}
|
||||||
|
var datalist1 = _sysSequentialService.Query<SysSequential>(m => m.StartTime == StartTime && m.EndTime == EndTime && m.IsDelete == 0 && m.Sequential == kind);
|
||||||
|
|
||||||
|
//更新时序母表状态 已生成未下发 -> action
|
||||||
|
foreach (var item in datalist1)
|
||||||
|
{
|
||||||
|
var data = _sysSequentialService.Find<SysSequential>(item.Number);
|
||||||
|
data.Status = action;
|
||||||
|
_sysSequentialService.Update(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user