Ver a proveniência

历史曲线添加

reconfiguration
pry há 2 meses
ascendente
cometimento
294c6caf14
32 ficheiros alterados com 1829 adições e 2412 eliminações
  1. +1
    -1
      BPASmartClient.Academy/50L/PlcControl.cs
  2. +82
    -3
      BPASmartClient.Academy/50L/SamplingData.cs
  3. +99
    -3
      BPASmartClient.Academy/50L/SqliteOperate.cs
  4. +14
    -80
      BPASmartClient.Academy/App.config
  5. +27
    -14
      BPASmartClient.Academy/App.xaml.cs
  6. +6
    -0
      BPASmartClient.Academy/BPASmartClient.Academy.csproj
  7. +1
    -4
      BPASmartClient.Academy/Model/HistorySqlite.cs
  8. +2
    -2
      BPASmartClient.Academy/Model/SaveNameData.cs
  9. +23
    -29
      BPASmartClient.Academy/Model/Simens_PLC.cs
  10. +4
    -3
      BPASmartClient.Academy/Model/Sqlite.cs
  11. +1
    -1
      BPASmartClient.Academy/Model/SqliteBase.cs
  12. +326
    -0
      BPASmartClient.Academy/View/DeviceChart50LView.xaml
  13. +178
    -0
      BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs
  14. +1
    -1
      BPASmartClient.Academy/View/DeviceMotionView.xaml
  15. +418
    -0
      BPASmartClient.Academy/View/HistoryChart50LView.xaml
  16. +134
    -0
      BPASmartClient.Academy/View/HistoryChart50LView.xaml.cs
  17. +5
    -5
      BPASmartClient.Academy/View/HistoryChartView.xaml.cs
  18. +1
    -1
      BPASmartClient.Academy/View/ParameterSetView.xaml.cs
  19. +0
    -1775
      BPASmartClient.Academy/View/ReactionKettle500LView.xaml
  20. +0
    -357
      BPASmartClient.Academy/View/ReactionKettle500LView.xaml.cs
  21. +102
    -0
      BPASmartClient.Academy/View/ReactionKettle50LView.xaml
  22. +32
    -0
      BPASmartClient.Academy/View/ReactionKettle50LView.xaml.cs
  23. +38
    -0
      BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs
  24. +195
    -0
      BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs
  25. +6
    -22
      BPASmartClient.Academy/ViewModel/HistoryChartViewModel.cs
  26. +0
    -16
      BPASmartClient.Academy/ViewModel/ReactionKettle500LViewModel.cs
  27. +16
    -0
      BPASmartClient.Academy/ViewModel/ReactionKettle50LViewModel.cs
  28. +13
    -11
      BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs
  29. +14
    -0
      BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs
  30. +78
    -72
      BPASmartClient.CustomResource/Pages/View/PromptView.xaml
  31. +1
    -1
      BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs
  32. +11
    -11
      BPASmartClient.CustomResource/UserControls/DeCanvas/RubberbandAdorner.cs

+ 1
- 1
BPASmartClient.Academy/50L/PlcControl.cs Ver ficheiro

@@ -20,7 +20,7 @@ namespace BPASmartClient.Academy._50L

public void Init()
{
//CommHelper.CreateSiemens(CpuType.S71200, Json<DevicePar>.Data.IpAddress).OnSuccess(s =>
//CommHelper.CreateSiemens(CpuType.S7200Smart, Json<DevicePar>.Data.IpAddress).OnSuccess(s =>
//{
// comm = s.Content;
// Read();


+ 82
- 3
BPASmartClient.Academy/50L/SamplingData.cs Ver ficheiro

@@ -1,6 +1,7 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Diagnostics.Metrics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@@ -8,22 +9,100 @@ using System.Threading.Tasks;
namespace BPASmartClient.Academy._50L
{
[SplitTable(SplitType.Month)]//按月分表
[SugarTable("SamplingData_{year}{month}{day}")]
public class SamplingData
{
[SplitField]//分表字段特性,标注之后在插入或者删除的时候都会根据这个创建时间来查找对应的表进行修改
public DateTime Createtime { get; set; }

public float a { get; set; }
public string Id { get; set; }

public string ProductNumberId { get; set; }

/// <summary>
/// 反应釜温度
/// </summary>
public float Temperature { get; set; }
/// <summary>
/// 反应釜蒸汽压力
/// </summary>
public float SteamPressure { get; set; }
/// <summary>
/// 反应釜蒸汽流量
/// </summary>
public float SteamFlowRate { get; set; }
/// <summary>
/// 冷凝水罐温度
/// </summary>
public float CondensateWaterTemperature { get; set; }
/// <summary>
/// 冷凝水罐湿度
/// </summary>
public float CondensateWaterHumidity { get; set; }
/// <summary>
/// 负压流量
/// </summary>
public float NegativePressureFlowRate { get; set; }
/// <summary>
/// 称重水罐重量
/// </summary>
public float WeighingWaterTankWeight { get; set; }
/// <summary>
/// 蒸汽比例阀实际开度
/// </summary>
public float ProportionalValveOpening { get; set; }

public SamplingData()
{
Createtime = DateTime.Now;
Id = Guid.NewGuid().ToString();
}

/// <summary>
/// 50L反应釜数据
/// </summary>
/// <param name="t">反应釜温度</param>
/// <param name="sp">反应釜蒸汽压力</param>
/// <param name="sfr">反应釜蒸汽流量</param>
/// <param name="cwt">冷凝水罐温度</param>
/// <param name="cwh">冷凝水罐湿度</param>
/// <param name="npfr">负压流量</param>
/// <param name="wwtw">称重水罐重量</param>
/// <param name="pvo">蒸汽比例阀实际开度</param>
/// <param name="pid">产品id</param>
public SamplingData(float t, float sp, float sfr, float cwt, float cwh, float npfr, float wwtw, float pvo, string pid)
{
Createtime = DateTime.Now;
Temperature = t;
SteamPressure = sp;
SteamFlowRate = sfr;
CondensateWaterTemperature = cwt;
CondensateWaterHumidity = cwh;
NegativePressureFlowRate = npfr;
WeighingWaterTankWeight = wwtw;
ProportionalValveOpening = pvo;
ProductNumberId = pid;
Id = Guid.NewGuid().ToString();
}

public SamplingData(float _a)
/// <summary>
/// 生成测试数据
/// </summary>
/// <param name="pid"></param>
public SamplingData(string pid)
{
Random random = new Random();
Createtime = DateTime.Now;
a = _a;
Temperature = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
SteamPressure = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
SteamFlowRate = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
CondensateWaterTemperature = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
CondensateWaterHumidity = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
NegativePressureFlowRate = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
WeighingWaterTankWeight = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
ProportionalValveOpening = Convert.ToSingle((random.NextSingle() * 100f).ToString("0.00"));
ProductNumberId = pid;
Id = Guid.NewGuid().ToString();
}
}
}

+ 99
- 3
BPASmartClient.Academy/50L/SqliteOperate.cs Ver ficheiro

@@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Linq;

namespace BPASmartClient.Academy._50L
{
@@ -14,7 +15,7 @@ namespace BPASmartClient.Academy._50L
public static SqliteOperate GetInstance => _Instance ?? (_Instance = new SqliteOperate());
private SqliteOperate() { }

static string directoryPath = $"AccessFile\\DB\\{Json<DevicePar>.Data.ProjectTypeName}";
static string directoryPath = $"AccessFile\\DB\\{Json<DevicePar>.Data.ProjectTypeName.ToString()}";
static string path
{
get
@@ -33,10 +34,105 @@ namespace BPASmartClient.Academy._50L

public void Init()
{
Db.CodeFirst.SplitTables().InitTables<SamplingData>();
try
{
Db.DbMaintenance.CreateDatabase();
Db.CodeFirst.SplitTables().InitTables<SamplingData>();
Db.CodeFirst.InitTables<SaveNameData>();

//CreateTestData();

}
catch (Exception ex)
{ }
}

Db.Insertable<SamplingData>(new SamplingData(5.0f)).SplitTable().ExecuteCommand();
/// <summary>
/// 生成测试数据
/// </summary>
private void CreateTestData()
{
for (int i = 0; i < 5; i++)
{
var d1 = new SaveNameData($"test{DateTime.Now.Ticks}");
Add(d1);
Random rd = new Random();
List<SamplingData> sd = new List<SamplingData>();
for (int m = 0; m < 10000; m++)
{
sd.Add(new SamplingData(d1.Id));
}
for (int x = 0; x < 10; x++)
{
Db.Insertable<SamplingData>(sd.GetRange(0 * 1000, 1000)).SplitTable().ExecuteCommand();
}
}
MessageNotify.GetInstance.OpenMsg("测试数据生成成功");
}

public void Add(SamplingData sd)
{
try
{
Db.Insertable<SamplingData>(sd).SplitTable().ExecuteCommand();
}
catch (Exception ex) { }
}

public void Add(SaveNameData snd)
{
try
{
Db.Insertable<SaveNameData>(snd).ExecuteCommand();
}
catch (Exception ex) { }
}

public List<SamplingData> QueryableById(string id)
{
try
{
return Db.Queryable<SamplingData>().SplitTable().Where(p => p.Id == id).ToList();
}
catch (Exception ex) { return new List<SamplingData>(); }
}

public List<SamplingData> QueryableByNum(string num)
{
try
{
var snd = Db.Queryable<SaveNameData>().First(p => p.ProductNumber == num);
if (snd != null)
return Db.Queryable<SamplingData>().SplitTable().Where(p => p.ProductNumberId == snd.Id).ToList();
else
return new List<SamplingData>();
}
catch (Exception ex) { return new List<SamplingData>(); }
}

public List<SaveNameData> FindNames(DateTime dt)
{
try
{
DateTime startOfDay = new DateTime(dt.Year, dt.Month, dt.Day, 0, 0, 0);
DateTime endOfDay = startOfDay.AddDays(1).AddTicks(-1);
return Db.Queryable<SaveNameData>().Where(p => p.Createtime >= startOfDay && p.Createtime < endOfDay).ToList();
}
catch (Exception ex) { return new List<SaveNameData>(); }
}

public List<SaveNameData> FindNames(string name)
{
try
{
if (string.IsNullOrEmpty(name))
{
MessageNotify.GetInstance.OpenMsg("请输入有效的产品编码!", EnumPromptType.Error, "错误");
return new List<SaveNameData>();
}
return Db.Queryable<SaveNameData>().Where(p => p.ProductNumber == name).ToList();
}
catch (Exception ex) { return new List<SaveNameData>(); }
}
}
}

+ 14
- 80
BPASmartClient.Academy/App.config Ver ficheiro

@@ -1,83 +1,17 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<sectionGroup name="FlexBatchSystem">
<section name="ProductInfo" type="System.Configuration.NameValueSectionHandler"/>
<section name="MqttInfo" type="System.Configuration.NameValueSectionHandler"/>
<section name="ConveyerInfo" type="System.Configuration.NameValueSectionHandler"/>
<section name="StockInfo1" type="System.Configuration.NameValueSectionHandler"/>
<section name="StockInfo2" type="System.Configuration.NameValueSectionHandler"/>
<section name="StockInfo3" type="System.Configuration.NameValueSectionHandler"/>
<section name="StockInfo4" type="System.Configuration.NameValueSectionHandler"/>
<section name="StockInfo5" type="System.Configuration.NameValueSectionHandler"/>
<section name="StockInfo6" type="System.Configuration.NameValueSectionHandler"/>
<section name="Services" type="System.Configuration.NameValueSectionHandler"/>
<section name="MQTTParam" type="System.Configuration.NameValueSectionHandler"/>
<section name="PLCInfo" type="System.Configuration.NameValueSectionHandler"/>
<section name="Alarm" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<FlexBatchSystem>
<ProductInfo>
<add key="ProductKey" value="j090GlJPJNv"/>
<add key="ProductSecret" value="OVTPKMuGlBLZRBFt"/>
<add key="Stock" value="StockModel"/>
<add key="Conveyer" value="ConveyerModel"/>
</ProductInfo>
<MqttInfo>
<add key="mqttHostUrl" value="iot-06z00carjduqaue.mqtt.iothub.aliyuncs.com"/>
</MqttInfo>
<ConveyerInfo>
<add key="DeviceName" value="Conveyer"/>
<add key="DeviceSecret" value="b3df8aaa82de59f478dffb172acf78cd"/>
</ConveyerInfo>
<StockInfo1>
<add key="DeviceName" value="Stock1"/>
<add key="DeviceSecret" value="b0928d8f6e36aabd94f0fce3f9b02536"/>
</StockInfo1>
<StockInfo2>
<add key="DeviceName" value="Stock2"/>
<add key="DeviceSecret" value="8373c57ddc6cd134b19cd89fad564157"/>
</StockInfo2>
<StockInfo3>
<add key="DeviceName" value="Stock3"/>
<add key="DeviceSecret" value="83f1457dbbb3c155d512c7a632d4c033"/>
</StockInfo3>
<StockInfo4>
<add key="DeviceName" value="Stock4"/>
<add key="DeviceSecret" value="9f9d37bebfc94900613890a294f1302d"/>
</StockInfo4>
<StockInfo5>
<add key="DeviceName" value="Stock5"/>
<add key="DeviceSecret" value="7ce871f33f86e9b71d30bdaa39899169"/>
</StockInfo5>
<StockInfo6>
<add key="DeviceName" value="Stock6"/>
<add key="DeviceSecret" value="f18b9d31180c7b7e32508b255c418d07"/>
</StockInfo6>
<Services>
<add key="Service1" value="RunControlService"/>
<add key="Service2" value="StockAirControlService"/>
<add key="Service3" value="RecipeSendService"/>
<add key="Service4" value="CancelRecipeService"/>

</Services>
<MQTTParam>
<add key="UserName" value="admin"/>
<add key="Password" value="admin8765490789"/>
<add key="IpAddress" value="111.9.47.105"/>
<add key="Port" value="18883"/>
</MQTTParam>
<PLCInfo>
<add key="IpAddress" value="192.168.2.1"/>
<add key="Port" value="502"/>
</PLCInfo>
<Alarm>
<add key="DB1.DBX2004.0" value="急停"/>
<add key="DB1.DBX2004.1" value="M101电机异常"/>
<add key="DB1.DBX2004.2" value="M102电机异常"/>
<add key="DB1.DBX2004.3" value="M103电机异常"/>
<add key="DB1.DBX2004.4" value="通讯异常"/>
</Alarm>
</FlexBatchSystem>
<configSections>
<sectionGroup name="FlexBatchSystem">
<section name="Alarm" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<FlexBatchSystem>
<Alarm>
<add key="DB1.DBX2004.0" value="急停"/>
<add key="DB1.DBX2004.1" value="M101电机异常"/>
<add key="DB1.DBX2004.2" value="M102电机异常"/>
<add key="DB1.DBX2004.3" value="M103电机异常"/>
<add key="DB1.DBX2004.4" value="通讯异常"/>
</Alarm>
</FlexBatchSystem>
</configuration>

+ 27
- 14
BPASmartClient.Academy/App.xaml.cs Ver ficheiro

@@ -4,6 +4,7 @@ using LiveCharts;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Linq.Expressions;
using System.Windows;

namespace BPASmartClient.Academy
@@ -49,10 +50,9 @@ namespace BPASmartClient.Academy
SystemHelper.GetInstance.CreateDesktopShortcut();
DataInit();
MenuInit();
PlcControl.GetInstance.Init();
MainView mv = new MainView();
MessageNotify.GetInstance.window = mv;
mv.TitleName = $"10L 反应釜焖制系统 V1.0.1";
string typeName = Json<DevicePar>.Data.ProjectTypeName == ProjectType.HKYF20240714.ToString() ? "10L" : "50L";
mv.TitleName = $"{typeName} 反应釜焖制系统 V1.0.1";
#if !DEBUG
LoginView lv = new LoginView();
var res = lv.ShowDialog();
@@ -136,27 +136,28 @@ namespace BPASmartClient.Academy
#endregion

#region 硬件设备监控
bool Is10L = Json<DevicePar>.Data.ProjectTypeName == ProjectType.HKYF20240714.ToString();
ObservableCollection<SubMenumodel> DeviceMonitor = new ObservableCollection<SubMenumodel>();
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "设备控制",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.Academy",
ToggleWindowPath = "View.DeviceMotionView"
ToggleWindowPath = Is10L ? "View.DeviceMotionView" : "View.ReactionKettle50LView"
});
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "数据曲线",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.Academy",
ToggleWindowPath = "View.DeviceChartView"
});
ToggleWindowPath = Is10L ? "View.DeviceChartView" : "View.DeviceChart50LView"
}); ;
DeviceMonitor.Add(new SubMenumodel()
{
SubMenuName = "历史曲线",
SubMenuPermission = new Permission[] { Permission.管理员, Permission.操作员, Permission.观察员, Permission.技术员 },
AssemblyName = "BPASmartClient.Academy",
ToggleWindowPath = "View.HistoryChartView"
ToggleWindowPath = Is10L ? "View.HistoryChartView" : "View.HistoryChart50LView"
});
MenuManage.GetInstance.menuModels.Add(new MenuModel()
{
@@ -267,14 +268,26 @@ namespace BPASmartClient.Academy

private void DataInit()
{
Json<LocalRecipe>.Read();
Json<DevicePar>.Read();
Json<LocaMaterial>.Read();
SqliteOperate.GetInstance.Init();
Sqlite.GetInstance.Init();
Simens_PLC.GetInstance.Connect();
Simens_PLC.GetInstance.Init();

//Json<LocalRecipe>.Read();
//Json<LocaMaterial>.Read();
if (Json<DevicePar>.Data.ProjectTypeName.TryToEnum(out ProjectType pt))
{
switch (pt)
{
case ProjectType.HKYF20240714:
Sqlite.GetInstance.Init();
Simens_PLC.GetInstance.Connect();
Simens_PLC.GetInstance.Init();
break;
case ProjectType.HKYF20240916:
SqliteOperate.GetInstance.Init();
PlcControl.GetInstance.Init();
break;
default:
break;
}
}
}

}


+ 6
- 0
BPASmartClient.Academy/BPASmartClient.Academy.csproj Ver ficheiro

@@ -28,4 +28,10 @@
<ProjectReference Include="..\BPASmartClient.Update\BPASmartClient.Update.csproj" />
</ItemGroup>

<ItemGroup>
<None Update="App.config">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>

+ 1
- 4
BPASmartClient.Academy/Model/HistorySqlite.cs Ver ficheiro

@@ -64,9 +64,6 @@ namespace BPASmartClient.Academy.Model
{
throw;
}



}

public void FindDateList()
@@ -129,7 +126,7 @@ namespace BPASmartClient.Academy.Model
}
else
{
MessageNotify.GetInstance.OpenMsg(EnumPromptType.Warn, "提示", "未找到对应的产品");
MessageNotify.GetInstance.OpenMsg("未找到对应的产品", EnumPromptType.Warn);
}
}



+ 2
- 2
BPASmartClient.Academy/Model/SaveNameData.cs Ver ficheiro

@@ -17,12 +17,12 @@ namespace BPASmartClient.Academy.Model
public SaveNameData(string productNumber)
{
ProductNumber = productNumber;
Date = DateTime.Now;
Createtime = DateTime.Now;
Id = Guid.NewGuid().ToString();
}
public SaveNameData()
{
Date = DateTime.Now;
Createtime = DateTime.Now;
Id = Guid.NewGuid().ToString();
}
}


+ 23
- 29
BPASmartClient.Academy/Model/Simens_PLC.cs Ver ficheiro

@@ -37,38 +37,32 @@ namespace BPASmartClient.Academy.Model
{
Task.Factory.StartNew(() =>
{
var x = (NameValueCollection)ConfigurationManager.GetSection("FlexBatchSystem/PLCInfo");
if (x != null)
CommHelper.CreateSiemens(CpuType.S7200Smart, Json<DevicePar>.Data.IpAddress).OnSuccess(o =>
{
string ip = x.Get("IpAddress");
//siemens.Connect(S7.Net.CpuType.S7200Smart, x.Get("IpAddress"), Convert.ToInt32(x.Get("Port")));
CommHelper.CreateSiemens(CpuType.S7200Smart, x.Get("IpAddress")).OnSuccess(o =>
siemens = o.Content;
IsConnected = true;
connect?.Invoke(true);
ThreadManage.GetInstance.StartLong(() =>
{
siemens = o.Content;
IsConnected = true;
connect?.Invoke(true);
ThreadManage.GetInstance.StartLong(() =>
{
ReadStatus();
}, "状态读取");
ThreadManage.GetInstance.StartLong(() =>
{
Heartbeat();
connect?.Invoke(IsConnected);
}, "心跳监听");
ThreadManage.GetInstance.StartLong(() =>
{
ChartDataRead();
}, "曲线数据");
ThreadManage.GetInstance.StartLong(() =>
{
AlarmRead();
}, "报警监控");
}).OnFailure(o =>
ReadStatus();
}, "状态读取");
ThreadManage.GetInstance.StartLong(() =>
{
IsConnected = false;
});
}
Heartbeat();
connect?.Invoke(IsConnected);
}, "心跳监听");
ThreadManage.GetInstance.StartLong(() =>
{
ChartDataRead();
}, "曲线数据");
ThreadManage.GetInstance.StartLong(() =>
{
AlarmRead();
}, "报警监控");
}).OnFailure(o =>
{
IsConnected = false;
});
});
}
public void Init()


+ 4
- 3
BPASmartClient.Academy/Model/Sqlite.cs Ver ficheiro

@@ -14,13 +14,14 @@ namespace BPASmartClient.Academy.Model
public static Sqlite GetInstance { get; set; } = instance ??= new Sqlite();
private Sqlite() { }
public List<SaveData> saveDatas { get; set; } = new List<SaveData>();
static string directoryPath = $"AccessFile\\DB\\{Json<DevicePar>.Data.ProjectTypeName}";
static string directoryPath = $"AccessFile\\DB\\{Json<DevicePar>.Data.ProjectTypeName.ToString()}";
static string path
{
get
{
Directory.CreateDirectory(AppDomain.CurrentDomain.BaseDirectory);
return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"{directoryPath}\\data{DateTime.Now.ToString("yyyy-MM-dd")}.db");
string tempPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"AccessFile\\DB\\{Json<DevicePar>.Data.ProjectTypeName.ToString()}");
Directory.CreateDirectory(tempPath);
return Path.Combine(tempPath, $"data{DateTime.Now.ToString("yyyy-MM-dd")}.db");
}
}
public SqlSugarScope Db = new SqlSugarScope(new ConnectionConfig()


+ 1
- 1
BPASmartClient.Academy/Model/SqliteBase.cs Ver ficheiro

@@ -9,7 +9,7 @@ namespace BPASmartClient.Academy.Model
{
public class SqliteBase : NotifyBase
{
public DateTime Date { get; set; }
public DateTime Createtime { get; set; }

[SugarColumn(IsPrimaryKey = true)]



+ 326
- 0
BPASmartClient.Academy/View/DeviceChart50LView.xaml Ver ficheiro

@@ -0,0 +1,326 @@
<UserControl
x:Class="BPASmartClient.Academy.View.DeviceChart50LView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:lvc="clr-namespace:LiveCharts.Wpf;assembly=LiveCharts.Wpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:oxy="http://oxyplot.org/wpf"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:DeviceChart50LViewModel />
</UserControl.DataContext>
<Grid>
<UniformGrid
x:Name="ooo"
Grid.Row="1"
Columns="2"
Rows="2">
<StackPanel Orientation="Vertical">
<lvc:CartesianChart
x:Name="ppp"
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="温度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Red"
StrokeThickness="2"
Values="{Binding DataFeedback.TempWok}" />
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Blue"
StrokeThickness="2"
Values="{Binding DataFeedback.TempMaterial}" />
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Green"
StrokeThickness="2"
Values="{Binding DataFeedback.TempVent}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="温度曲线/℃" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="Blue" />
<TextBlock Foreground="White" Text="物料罐温度" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="Red" />
<TextBlock Foreground="White" Text="反应釜温度" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="Green" />
<TextBlock Foreground="White" Text="排气温度" />
</StackPanel>

</StackPanel>

<StackPanel Margin="20,0,0,0" Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="转速曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#F44F15"
StrokeThickness="2"
Values="{Binding DataFeedback.M101_Speed}" />
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#423FFD"
StrokeThickness="2"
Values="{Binding DataFeedback.M102_Speed}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="转速曲线/rpm" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="#423FFD" />
<TextBlock Foreground="White" Text="物料罐转速" />
<Rectangle
Width="20"
Height="2"
Margin="10,0,0,2"
Fill="#F44F15" />
<TextBlock Foreground="White" Text="反应釜转速" />
</StackPanel>

</StackPanel>

<!--<StackPanel Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="比例阀开度曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="White"
StrokeThickness="2"
Values="{Binding DataFeedback.OpenValve}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis
LabelFormatter="{Binding DateTimeFormatter}"
Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="比例阀开度曲线" />
<Rectangle
Width="20"
Height="2"
Margin="20,0,0,2"
Fill="White" />
<TextBlock Foreground="White" Text="比例阀开度" />
</StackPanel>

</StackPanel>-->

<!--<StackPanel Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="压力曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="#F1C74B"
StrokeThickness="2"
Values="{Binding DataFeedback.PressureWok}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis
LabelFormatter="{Binding doubleFormatter}"
MaxValue="1.0"
MinValue="0">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis
LabelFormatter="{Binding DateTimeFormatter}"
Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="压力曲线/Mpa" />
<Rectangle
Width="20"
Height="2"
Margin="20,0,0,2"
Fill="#F1C74B" />
<TextBlock Foreground="White" Text="反应釜压力" />
</StackPanel>

</StackPanel>-->

<StackPanel Margin="0,20,0,0" Orientation="Vertical">
<lvc:CartesianChart
Height="270"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
AnimationsSpeed="0:0:1"
DataTooltip="{x:Null}"
Hoverable="False"
MouseDoubleClick="DataView_CLick"
ToolTip="重量曲线">
<lvc:CartesianChart.Series>
<lvc:LineSeries
Fill="Transparent"
LineSmoothness="1"
PointGeometry="{x:Null}"
Stroke="Purple"
StrokeThickness="2"
Values="{Binding DataFeedback.WeightWok}" />
</lvc:CartesianChart.Series>
<lvc:CartesianChart.AxisY>
<lvc:Axis>
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisY>
<lvc:CartesianChart.AxisX>
<lvc:Axis LabelFormatter="{Binding DateTimeFormatter}" Unit="{Binding AxisUnit}">
<lvc:Axis.Separator>
<lvc:Separator IsEnabled="False" Step="{Binding AxisStep}" />
</lvc:Axis.Separator>
</lvc:Axis>
</lvc:CartesianChart.AxisX>
</lvc:CartesianChart>
<StackPanel Margin="0,10,0,0" Orientation="Horizontal">
<TextBlock Foreground="White" Text="重量曲线/kg" />
<Rectangle
Width="20"
Height="2"
Margin="20,0,0,2"
Fill="Purple" />
<TextBlock Foreground="White" Text="冷却水罐重量" />
</StackPanel>

</StackPanel>
</UniformGrid>
<Grid
x:Name="chartGrid"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
Background="White"
Visibility="Collapsed">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="200" />
</Grid.ColumnDefinitions>
<oxy:PlotView
x:Name="chartView"
Margin="5"
Background="Transparent"
Foreground="Black"
PanCursor="Hand" />
<Button
Grid.Column="1"
Width="120"
Height=" 40"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Click="Button_Click"
Content="退出" />
</Grid>
</Grid>
</UserControl>

+ 178
- 0
BPASmartClient.Academy/View/DeviceChart50LView.xaml.cs Ver ficheiro

@@ -0,0 +1,178 @@
using LiveCharts.Definitions.Charts;
using LiveCharts.Wpf;
using OxyPlot.Axes;
using OxyPlot;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ThingsGateway.Foundation.Core;

namespace BPASmartClient.Academy.View
{
/// <summary>
/// DeviceChartView.xaml 的交互逻辑
/// </summary>
public partial class DeviceChart50LView : UserControl
{
public DeviceChart50LView()
{
InitializeComponent();
}


public PlotModel plotModel { get; set; } = new PlotModel();
private void DataView_CLick(object sender, MouseButtonEventArgs e)
{
ooo.Visibility = Visibility.Collapsed;
double min = DateTimeAxis.ToDouble(System.DateTime.Now.AddMinutes(-10));
double max = DateTimeAxis.ToDouble(System.DateTime.Now);
double maxrange = max - min;
CartesianChart liveCharts = sender as CartesianChart;

switch (liveCharts.ToolTip)
{
case "温度曲线":
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "温度曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_1 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜排气温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_2 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> twValues = new List<DataPoint>();
List<DataPoint> tvValues = new List<DataPoint>();
List<DataPoint> tmValues = new List<DataPoint>();
Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
{
twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempWok));
tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempVent));
tmValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempMaterial));

});
line.Points.AddRange(twValues);
line_1.Points.AddRange(tvValues);
line_2.Points.AddRange(tmValues);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line);
plotModel.Series.Add(line_1);
plotModel.Series.Add(line_2);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
break;
case "转速曲线":
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "转速曲线" };
chartGrid.Visibility = Visibility.Visible;
OxyPlot.Series.LineSeries line_3 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
OxyPlot.Series.LineSeries line_4 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
List<DataPoint> m101 = new List<DataPoint>();
List<DataPoint> m102 = new List<DataPoint>();
Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
{
m101.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M101_Speed));
m102.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M102_Speed));

});
line_3.Points.AddRange(m101);
line_4.Points.AddRange(m102);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "转速/rpm", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_3);
plotModel.Series.Add(line_4);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
break;
//case "比例阀开度曲线":
// plotModel.Series.Clear();
// plotModel = new PlotModel() { Title = "比例阀开度曲线" };
// chartGrid.Visibility = Visibility.Visible;
// List<DataPoint> open = new List<DataPoint>();
// Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
// {
// open.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.OpenValve));

// });
// line.Points.AddRange(open);
// if (!(plotModel.Axes.Count > 0))
// {
// plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
// plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "比例阀开度/挡", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
// }
// plotModel.Series.Add(line);
// plotModel.InvalidatePlot(true);//重新加载曲线
// chartView.Model = plotModel;
// break;
//case "压力曲线":
// plotModel.Series.Clear();
// plotModel = new PlotModel() { Title = "反应釜压力曲线" };
// chartGrid.Visibility = Visibility.Visible;
// List<DataPoint> pressure = new List<DataPoint>();
// Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
// {
// pressure.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.PressureWok));

// });
// line.Points.AddRange(pressure);
// if (!(plotModel.Axes.Count > 0))
// {
// plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max, MaximumRange = maxrange });
// plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "反应釜压力/Mpa", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2"), IsZoomEnabled = false });
// }
// plotModel.Series.Add(line);
// plotModel.InvalidatePlot(true);//重新加载曲线
// chartView.Model = plotModel;
// break;
case "重量曲线":
plotModel.Series.Clear();
plotModel = new PlotModel() { Title = "冷却水罐重量曲线" };
chartGrid.Visibility = Visibility.Visible;
List<DataPoint> ww = new List<DataPoint>();
OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(0, 0, 0), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
Sqlite.GetInstance.SelectId(Simens_PLC.GetInstance.id).ForEach(t =>
{
ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.WeightWok));

});
line_5.Points.AddRange(ww);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss", Minimum = min, Maximum = max });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "冷却水罐重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);
plotModel.InvalidatePlot(true);//重新加载曲线
chartView.Model = plotModel;
break;
default:
break;
}
}

private void Button_Click(object sender, RoutedEventArgs e)
{
chartGrid.Visibility = Visibility.Collapsed;
ooo.Visibility = Visibility.Visible;
plotModel.Axes.Clear();
plotModel.Series.Clear();
plotModel.InvalidatePlot(true);
chartView.Model = plotModel;
}
}
}

+ 1
- 1
BPASmartClient.Academy/View/DeviceMotionView.xaml Ver ficheiro

@@ -3,11 +3,11 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:bpa="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
d:DataContext="{d:DesignInstance Type=vm:DeviceMotionViewModel}"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DataContext="{d:DesignInstance Type=vm:DeviceMotionViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">


+ 418
- 0
BPASmartClient.Academy/View/HistoryChart50LView.xaml Ver ficheiro

@@ -0,0 +1,418 @@
<UserControl
x:Class="BPASmartClient.Academy.View.HistoryChart50LView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:oxy="http://oxyplot.org/wpf"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.DataContext>
<vm:HistoryChart50LViewModel />
</UserControl.DataContext>
<UserControl.Resources>
<Style x:Key="setCheck" TargetType="{x:Type RadioButton}">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border Background="Transparent" BorderThickness="0">
<ContentControl
x:Name="check"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
Foreground="#777777" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="check" Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter TargetName="check" Property="Foreground" Value="White" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel
Margin="0,0,60,0"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="DeepSkyBlue"
Text="产品编号:" />
<TextBox
Width="200"
Height="30"
Margin="0,0,10,0"
VerticalContentAlignment="Center"
Background="Transparent"
BorderBrush="DeepSkyBlue"
CaretBrush="DeepSkyBlue"
FontSize="16"
Foreground="DeepSkyBlue"
Style="{x:Null}"
Text="{Binding ProductNum}" />

<Button
Width="120"
Height="30"
Command="{Binding FindProductCommand}"
Content="查询编号"
Style="{StaticResource ButtonStyle}" />

<TextBlock
Margin="30,0,0,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="DeepSkyBlue"
Text="查询时间:" />
<DatePicker
Width="150"
Margin="0,0,10,0"
BorderBrush="DeepSkyBlue"
FontSize="16"
SelectedDate="{Binding SelectTime}"
Style="{DynamicResource PickerStyle}" />

<Button
Width="120"
Height="30"
Command="{Binding Select}"
Content="查询"
Style="{StaticResource ButtonStyle}" />
</StackPanel>

<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<!--#region 表格-->
<Grid
Grid.Column="0"
Margin="20,20,20,300"
Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
</Grid.RowDefinitions>
<!--#region 标题-->
<Grid Background="#ff0C255F">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Border
Grid.ColumnSpan="1"
BorderBrush="#777777"
BorderThickness="0.8" />
<Border
Grid.ColumnSpan="2"
BorderBrush="#777777"
BorderThickness="0,0.8,0.8,0.8" />
<Border
Grid.ColumnSpan="3"
BorderBrush="#777777"
BorderThickness="0,0.8,0.8,0.8" />
<Border
Grid.ColumnSpan="4"
BorderBrush="#777777"
BorderThickness="0,0.8,0.8,0.8" />
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="序号" />
<TextBlock
Grid.Column="1"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="配方名称" />
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="创建时间" />
<TextBlock
Grid.Column="3"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="操作" />
</Grid>
<!--#endregion-->
<!--#region 表格内容-->
<ScrollViewer
Grid.Row="1"
HorizontalScrollBarVisibility="Hidden"
VerticalScrollBarVisibility="Hidden">
<ItemsControl ItemsSource="{Binding RecipeCharts}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid
Height="30"
Margin="0,1"
Background="#163175">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="50" />
<ColumnDefinition />
<ColumnDefinition Width="120" />
<ColumnDefinition Width="50" />
</Grid.ColumnDefinitions>
<Border
Grid.ColumnSpan="1"
BorderBrush="#777777"
BorderThickness="0.4" />
<Border
Grid.ColumnSpan="2"
BorderBrush="#777777"
BorderThickness="0,0.4,0.4,0.4" />
<Border
Grid.ColumnSpan="3"
BorderBrush="#777777"
BorderThickness="0,0.4,0.4,0.4" />
<Border
Grid.ColumnSpan="4"
BorderBrush="#777777"
BorderThickness="0,0.4,0.4,0.4" />
<TextBlock
x:Name="num"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="{Binding Num}" />
<TextBlock
Grid.Column="1"
Margin="5,0,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="{Binding Name}" />
<TextBlock
Grid.Column="2"
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="16"
Foreground="White"
Text="{Binding CreateTime, StringFormat={}{0:yyyy-MM-dd}}" />
<RadioButton
x:Name="ceshi"
Grid.Column="3"
Command="{Binding DataContext.InspectDataCommand, RelativeSource={RelativeSource AncestorType={x:Type UserControl}, Mode=FindAncestor}}"
CommandParameter="{Binding Name}"
Content="查看"
FontSize="16"
Foreground="White"
GroupName="sss"
Style="{StaticResource setCheck}" />
</Grid>
<!--<Popup
HorizontalAlignment="Center"
VerticalAlignment="Center"
AllowsTransparency="True"
IsOpen="{Binding ElementName=ceshi, Path=IsChecked, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
MouseLeave="Popup_MouseLeave"
Placement="Bottom"
PlacementTarget="{Binding ElementName=ceshi}">
<Grid
Width="200"
Height="200"
Background="Transparent">
<Path
Fill="#ff0C255F"
Stroke="White"
StrokeThickness="1">
<Path.Data>
<GeometryGroup>
<PathGeometry>
<PathFigure StartPoint="0,10">
<LineSegment Point="0,200" />
<LineSegment Point="200,200" />
<LineSegment Point="200,10" />
<LineSegment Point="60,10" />
<LineSegment Point="50,0" />
<LineSegment Point="40,10" />
<LineSegment Point="0,10" />
</PathFigure>
</PathGeometry>
</GeometryGroup>
</Path.Data>
</Path>

<StackPanel
Margin="0,30,0,20"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical">
<Border Margin="0,10">
<Button
Width="100"
Height="35"
Click="Button_Click"
CommandParameter="{Binding ElementName=num, Path=Text, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Content="温度曲线"
Style="{StaticResource ButtonStyle}" />
</Border>
<Border Margin="0,10">
<Button
Width="100"
Height="35"
Click="Button_Click"
CommandParameter="{Binding ElementName=num, Path=Text, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Content="转速曲线"
Style="{StaticResource ButtonStyle}" />
</Border>
<Border Margin="0,10">
<Button
Width="100"
Height="35"
Click="Button_Click"
CommandParameter="{Binding ElementName=num, Path=Text, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"
Content="重量曲线"
Style="{StaticResource ButtonStyle}" />
</Border>
</StackPanel>
</Grid>
</Popup>-->
</Grid>

</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</ScrollViewer>
<!--#endregion-->
</Grid>

<!--#endregion-->
<!--#region 曲线-->
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="30" />
<RowDefinition />
</Grid.RowDefinitions>

<UniformGrid Columns="8">
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="0"
Content="反应釜温度"
FontSize="14"
Foreground="Red"
IsChecked="{Binding VisStatus[0]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="1"
Content="反应釜蒸汽压力"
FontSize="14"
Foreground="#90EE90"
IsChecked="{Binding VisStatus[1]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="2"
Content="反应釜蒸汽流量"
FontSize="14"
Foreground="DeepSkyBlue"
IsChecked="{Binding VisStatus[2]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="3"
Content="冷凝水罐温度"
FontSize="14"
Foreground="Yellow"
IsChecked="{Binding VisStatus[3]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="4"
Content="冷凝水罐湿度"
FontSize="14"
Foreground="Orange"
IsChecked="{Binding VisStatus[4]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="5"
Content="负压流量"
FontSize="14"
Foreground="#9B30FF"
IsChecked="{Binding VisStatus[5]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="6"
Content="称重水罐重量"
FontSize="14"
Foreground="Aqua"
IsChecked="{Binding VisStatus[6]}"
IsEnabled="{Binding IsEnable}" />
<CheckBox
Command="{Binding CheckedCommand}"
CommandParameter="7"
Content="比例阀开度"
FontSize="14"
Foreground="#FF00FF"
IsChecked="{Binding VisStatus[7]}"
IsEnabled="{Binding IsEnable}" />
</UniformGrid>

<oxy:PlotView
x:Name="chartView"
Grid.Row="1"
Margin="5"
Background="White"
Foreground="White"
Model="{Binding OxyModel}"
PanCursor="Hand" />

<Border
Grid.Row="1"
Background="#dd727272"
Visibility="{Binding LoadingVis}">
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="20"
Text="正在加载数据,请耐心等待..." />
</Border>

</Grid>

<!--#endregion-->

</Grid>

</Grid>
</UserControl>

+ 134
- 0
BPASmartClient.Academy/View/HistoryChart50LView.xaml.cs Ver ficheiro

@@ -0,0 +1,134 @@
using BPASmartClient.CustomResource.UserControls.MessageShow;
using BPASmartClient.CustomResource.UserControls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Controls.Primitives;
using OxyPlot;
using OxyPlot.Axes;

namespace BPASmartClient.Academy.View
{
/// <summary>
/// HistoryChartView.xaml 的交互逻辑
/// </summary>
public partial class HistoryChart50LView : UserControl
{
public HistoryChart50LView()
{
InitializeComponent();
}
//public PlotModel plotModel { get; set; } = new PlotModel();
//private void Button_Click(object sender, RoutedEventArgs e)
//{
// Button button = sender as Button;
// int num;
// bool suc = int.TryParse(button.CommandParameter.ToString(), out num);
// RecipeChart recipeChart = HistorySqlite.GetInstance.recipeCharts.FirstOrDefault(o => o.Num == num);
// switch (button.Content.ToString())
// {
// case "温度曲线":
// plotModel.Series.Clear();
// plotModel = new PlotModel() { Title = "温度曲线" };
// OxyPlot.Series.LineSeries line = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
// OxyPlot.Series.LineSeries line_1 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜排气温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
// OxyPlot.Series.LineSeries line_2 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐温度", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
// List<DataPoint> twValues = new List<DataPoint>();
// List<DataPoint> tvValues = new List<DataPoint>();
// List<DataPoint> tmValues = new List<DataPoint>();
// HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
// HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
// {
// twValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempWok));
// tvValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempVent));
// tmValues.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.TempMaterial));

// });
// line.Points.AddRange(twValues);
// line_1.Points.AddRange(tvValues);
// line_2.Points.AddRange(tmValues);
// if (!(plotModel.Axes.Count > 0))
// {
// plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss" });
// plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString() });
// }
// plotModel.Series.Add(line);
// plotModel.Series.Add(line_1);
// plotModel.Series.Add(line_2);
// plotModel.InvalidatePlot(true);//重新加载曲线
// chartView.Model = plotModel;
// break;
// case "转速曲线":
// plotModel.Series.Clear();
// plotModel = new PlotModel() { Title = "转速曲线" };
// OxyPlot.Series.LineSeries line_3 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "反应釜转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
// OxyPlot.Series.LineSeries line_4 = new OxyPlot.Series.LineSeries() { LineStyle = LineStyle.Solid, Title = "配料罐转速", MarkerFill = OxyColor.FromRgb(110, 79, 79), MarkerSize = 2, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
// List<DataPoint> m101 = new List<DataPoint>();
// List<DataPoint> m102 = new List<DataPoint>();
// HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
// HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
// {
// m101.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M101_Speed));
// m102.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.M102_Speed));

// });
// line_3.Points.AddRange(m101);
// line_4.Points.AddRange(m102);
// if (!(plotModel.Axes.Count > 0))
// {
// plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss" });
// plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "转速/rpm", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString() });
// }
// plotModel.Series.Add(line_3);
// plotModel.Series.Add(line_4);
// plotModel.InvalidatePlot(true);//重新加载曲线
// chartView.Model = plotModel;
// break;
// case "重量曲线":
// plotModel.Series.Clear();
// plotModel = new PlotModel() { Title = "冷却水罐重量曲线" };
// List<DataPoint> ww = new List<DataPoint>();
// OxyPlot.Series.LineSeries line_5 = new OxyPlot.Series.LineSeries() { Title = "冷却水罐重量", Color = OxyColor.FromRgb(0, 0, 0), LineStyle = LineStyle.Solid, LineLegendPosition = OxyPlot.Series.LineLegendPosition.End };
// HistorySqlite.GetInstance.DateString = recipeChart.CreateTime.ToString("yyyy-MM-dd");
// HistorySqlite.GetInstance.SelectName(recipeChart.Name).ForEach(t =>
// {
// ww.Add(new DataPoint(DateTimeAxis.ToDouble(t.Date), t.WeightWok));

// });
// line_5.Points.AddRange(ww);
// if (!(plotModel.Axes.Count > 0))
// {
// plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss" });
// plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "冷却水罐重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
// }
// plotModel.Series.Add(line_5);
// plotModel.InvalidatePlot(true);//重新加载曲线
// chartView.Model = plotModel;
// break;
// default:
// break;
// }
// App.Current.Dispatcher.Invoke(() =>
// {
// NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, App.MainWindow, "提示", "你点击了温度按钮", 1, 1);
// });
//}

private void Popup_MouseLeave(object sender, MouseEventArgs e)
{
Popup popup = sender as Popup;
popup.IsOpen = false;
}
}
}

+ 5
- 5
BPASmartClient.Academy/View/HistoryChartView.xaml.cs Ver ficheiro

@@ -34,9 +34,9 @@ namespace BPASmartClient.Academy.View
{
Button button = sender as Button;
int num;
bool suc=int.TryParse(button.CommandParameter.ToString(),out num);
RecipeChart recipeChart = HistorySqlite.GetInstance.recipeCharts.FirstOrDefault(o=>o.Num == num);
switch (button.Content.ToString())
bool suc = int.TryParse(button.CommandParameter.ToString(), out num);
RecipeChart recipeChart = HistorySqlite.GetInstance.recipeCharts.FirstOrDefault(o => o.Num == num);
switch (button.Content.ToString())
{
case "温度曲线":
plotModel.Series.Clear();
@@ -60,7 +60,7 @@ namespace BPASmartClient.Academy.View
line_2.Points.AddRange(tmValues);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss"});
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间", StringFormat = "hh:mm:ss" });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "温度/℃", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString() });
}
plotModel.Series.Add(line);
@@ -109,7 +109,7 @@ namespace BPASmartClient.Academy.View
line_5.Points.AddRange(ww);
if (!(plotModel.Axes.Count > 0))
{
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss"});
plotModel.Axes.Add(new DateTimeAxis() { Position = OxyPlot.Axes.AxisPosition.Bottom, Title = "时间/s", StringFormat = "hh:mm:ss" });
plotModel.Axes.Add(new LinearAxis() { Key = "y1", Title = "冷却水罐重量/kg", Position = OxyPlot.Axes.AxisPosition.Left, LabelFormatter = value => value.ToString("f2") });
}
plotModel.Series.Add(line_5);


+ 1
- 1
BPASmartClient.Academy/View/ParameterSetView.xaml.cs Ver ficheiro

@@ -27,7 +27,7 @@ namespace BPASmartClient.Academy.View
this.btn_save.Click += (s, e) =>
{
Json<DevicePar>.Save();
MessageNotify.GetInstance.OpenMsg(EnumPromptType.Success, "提示", "参数保存成功!");
MessageNotify.GetInstance.OpenMsg("参数保存成功!", EnumPromptType.Success);
this.Close();
};
}


+ 0
- 1775
BPASmartClient.Academy/View/ReactionKettle500LView.xaml
A apresentação das diferenças no ficheiro foi suprimida por ser demasiado grande
Ver ficheiro


+ 0
- 357
BPASmartClient.Academy/View/ReactionKettle500LView.xaml.cs Ver ficheiro

@@ -1,357 +0,0 @@
using BPASmartClient.CustomResource.UserControls.MessageShow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.Academy.View
{
/// <summary>
/// ReactionKettle500LView.xaml 的交互逻辑
/// </summary>
public partial class ReactionKettle500LView : UserControl
{
public ReactionKettle500LView()
{
InitializeComponent();
this.DataContext = ReactionKettle500LViewModel.GetInstance;
this.Loaded += DeviceMotionView_Loaded;
}

private void DeviceMotionView_Loaded(object sender, RoutedEventArgs e)
{
Simens_PLC.GetInstance.connect = o =>
{
//App.Current.Dispatcher.Invoke(() =>
//{
// if (o)
// {
// ooo.Opacity = 1;
// ooo.IsHitTestVisible = true;
// state.Visibility = Visibility.Collapsed;
// }
// else
// {

// ooo.Opacity = 0.5;
// ooo.IsHitTestVisible = false;
// state.Text = "设 备 未 连 接";
// //MessageNotify.GetInstance.ShowRunLog("设备未连接");
// state.Visibility = Visibility.Visible;
// state.Foreground = Brushes.Red;
// }
//});

};
}

private string tempName = "配料罐升温";
private void auto_click(object sender, RoutedEventArgs e)
{
RadioButton radioButton = (RadioButton)sender;
switch (radioButton.Content.ToString())
{
case "反应釜升温":
tempName = "反应釜升温";
wokTemp.Visibility = Visibility.Visible;
caliTemp.Visibility = Visibility.Collapsed;
break;
case "配料罐升温":
tempName = "配料罐升温";
wokTemp.Visibility = Visibility.Visible;
caliTemp.Visibility = Visibility.Collapsed;
break;
case "反应釜降温":
tempName = "反应釜降温";
wokTemp.Visibility = Visibility.Visible;
caliTemp.Visibility = Visibility.Collapsed;
break;
case "温度校准":
tempName = "温度校准";
wokTemp.Visibility = Visibility.Collapsed;
caliTemp.Visibility = Visibility.Visible;
break;
default:
break;
}
}

private void Open_Click(object sender, RoutedEventArgs e)
{
RadioButton radioButton = sender as RadioButton;
if (radioButton.Content.ToString().Contains("配料搅拌"))
{
hzSet.Visibility = Visibility.Visible;
motorName.Text = "配料搅拌频率:";
ooo.Opacity = 0.5;
ooo.IsHitTestVisible = false;
}
if (radioButton.Content.ToString().Contains("反应釜搅拌"))
{
hzSet.Visibility = Visibility.Visible;
motorName.Text = "反应釜搅拌频率:";
ooo.Opacity = 0.5;
ooo.IsHitTestVisible = false;
}
if (Simens_PLC.GetInstance.IsConnected)
{

int bit = Convert.ToInt32(radioButton.Tag.ToString());
if (bit < 8)
{
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1000.{bit}", true);
}
else if (bit < 16)
{
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1001.{bit - 8}", true);
}
else
{
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1002.{bit - 16}", true);
}
}
}

private void Close_Click(object sender, RoutedEventArgs e)
{
RadioButton radioButton = sender as RadioButton;
if (Simens_PLC.GetInstance.IsConnected)
{
int bit = Convert.ToInt32(radioButton.Tag.ToString());
if (bit < 8)
{
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1000.{bit}", false);
}
else if (bit < 16)
{
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1001.{bit - 8}", false);
}
else
{
Simens_PLC.GetInstance.siemens.Write<bool>($"DB1.DBX1002.{bit - 16}", false);
}
}

}






private void TempSet_CLick(object sender, RoutedEventArgs e)
{
bool suc;
switch (tempName)
{
case "反应釜升温":
int tempValue;
suc = int.TryParse(temp_1.Text.ToString(), out tempValue);
if (suc)
{
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1001.7", true);
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1020", tempValue);
}
else
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "请检查温度输入是否正确", 1, 1);
});
}

break;
case "配料罐升温":
suc = int.TryParse(temp_1.Text.ToString(), out tempValue);
//int time;
//suc = int.TryParse(time_1.Text.ToString(), out time);
if (suc)
{
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1001.6", true);
//Simens_PLC.GetInstance.siemens.Write<ushort>("DB1.DBD100", (ushort)(time*10));
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1016", tempValue);
}
else
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "请检查温度输入是否正确", 1, 1);
});
}
break;
case "反应釜降温":
suc = int.TryParse(temp_1.Text.ToString(), out tempValue);
//int time;
//suc = int.TryParse(time_1.Text.ToString(), out time);
if (suc)
{
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1003.0", true);
//Simens_PLC.GetInstance.siemens.Write<ushort>("DB1.DBD100", (ushort)(time*10));
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1020", tempValue);
}
else
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "请检查温度输入是否正确", 1, 1);
});
}
break;
case "温度校准":
bool val = true;
int value;
suc = int.TryParse(tempvent.Text.ToString(), out value);
if (suc)
{
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1024", value).OnFailure(o =>
{
val = false;
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "反应釜排气温度写入失败", 1, 1);
});
});
}
else
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "请检查排气温度校准输入", 1, 1);
});
}
suc = int.TryParse(tempmaterial.Text.ToString(), out value);
if (suc)
{
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1028", value).OnFailure(o =>
{
val = false;
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "配料罐温度写入失败", 1, 1);
});
});
}
else
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "请检查配料罐温度校准输入", 1, 1);
});
}
suc = int.TryParse(tempwok.Text.ToString(), out value);
if (suc)
{
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1032", value).OnFailure(o =>
{
val = false;
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "反应釜温度写入失败", 1, 1);
});
});
}
else
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "请检查反应釜温度校准输入", 1, 1);
});
}
if (val)
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Info, App.MainWindow, "成功", "校准完成", 1, 1);
});
}
break;
default:
break;
}
}

private void hzSet_Click(object sender, RoutedEventArgs e)
{
hzSet.Visibility = Visibility.Collapsed;
int value;
bool suc = int.TryParse(motorValue.Text.ToString(), out value);
if (suc && Simens_PLC.GetInstance.IsConnected && value >= 20 && value <= 100)
{
if (motorName.Text.ToString().Contains("配料搅拌"))
{
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1004", value).OnFailure(o =>
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "频率写入失败", 1, 1);
});
});
}
if (motorName.Text.ToString().Contains("反应釜搅拌"))
{
Simens_PLC.GetInstance.siemens.Write<int>("DB1.DBD1008", value).OnFailure(o =>
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "频率写入失败", 1, 1);
});
});

}
}
else
{
App.Current.Dispatcher.Invoke(() =>
{
NoticeDemoViewModel.OpenMsg(EnumPromptType.Warn, App.MainWindow, "警告", "请检查频率设备连接、数据格式等", 1, 1);
});
}
ooo.Opacity = 1;
ooo.IsHitTestVisible = true;
}

private void hzCancel_Click(object sender, RoutedEventArgs e)
{
hzSet.Visibility = Visibility.Collapsed;
ooo.Opacity = 1;
ooo.IsHitTestVisible = true;
}

private void TempCLose_CLick(object sender, RoutedEventArgs e)
{
switch (tempName)
{
case "配料罐升温":
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1001.6", false);
break;
case "反应釜升温":
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1001.7", false);
break;
case "反应釜降温":
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1003.0", false);
break;
default:
break;
}
}

private void ClearBtn_CLick(object sender, RoutedEventArgs e)
{
if (Simens_PLC.GetInstance.IsConnected)
{
Simens_PLC.GetInstance.siemens.Write<bool>("DB1.DBX1002.7", true);
}
}

}
}

+ 102
- 0
BPASmartClient.Academy/View/ReactionKettle50LView.xaml Ver ficheiro

@@ -0,0 +1,102 @@
<UserControl
x:Class="BPASmartClient.Academy.View.ReactionKettle50LView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:bpa="clr-namespace:BPASmartClient.CustomResource.UserControls;assembly=BPASmartClient.CustomResource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:BPASmartClient.Academy.View"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:BPASmartClient.Academy.ViewModel"
d:DataContext="{d:DesignInstance Type=vm:ReactionKettle500LViewModel}"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d">
<UserControl.Resources>
<Style x:Key="checkBox" TargetType="{x:Type CheckBox}">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type CheckBox}">
<Border
x:Name="bord"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentControl
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="bord" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/红色圆角矩形背景.png" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="bord" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/buttonOff.png" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style x:Key="radiobutton" TargetType="RadioButton">
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Border
x:Name="bord"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<ContentControl
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Content="{TemplateBinding Content}"
Foreground="{TemplateBinding Foreground}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="bord" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/红色圆角矩形背景.png" />
</Setter.Value>
</Setter>
</Trigger>
<Trigger Property="IsChecked" Value="False">
<Setter TargetName="bord" Property="Background">
<Setter.Value>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/buttonOff.png" />
</Setter.Value>
</Setter>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<TextBlock
HorizontalAlignment="Center"
VerticalAlignment="Center"
FontSize="30"
Foreground="White"
Text="50L 反应釜" />
</Grid>
</UserControl>

+ 32
- 0
BPASmartClient.Academy/View/ReactionKettle50LView.xaml.cs Ver ficheiro

@@ -0,0 +1,32 @@
using BPASmartClient.CustomResource.UserControls.MessageShow;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace BPASmartClient.Academy.View
{
/// <summary>
/// ReactionKettle500LView.xaml 的交互逻辑
/// </summary>
public partial class ReactionKettle50LView : UserControl
{
public ReactionKettle50LView()
{
InitializeComponent();
this.DataContext = ReactionKettle50LViewModel.GetInstance;
}


}
}

+ 38
- 0
BPASmartClient.Academy/ViewModel/DeviceChart50LViewModel.cs Ver ficheiro

@@ -0,0 +1,38 @@
using BPASmartClient.Academy.Model;
using LiveCharts;
using LiveCharts.Configurations;
using LiveCharts.Wpf;
using OxyPlot.Axes;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy.ViewModel
{
public class DeviceChart50LViewModel : NotifyBase
{
public DeviceChart50LViewModel()
{
DataFeedback = new DataFeedback();
var mapper = Mappers.Xy<DataValue>()
.X(model => model.DateTime.Ticks)
.Y(model => model.Value);
Charting.For<DataValue>(mapper);
DataFeedback = Simens_PLC.GetInstance.dataFeedback;
}


private DataFeedback dataFeedback;
public DataFeedback DataFeedback { get { return dataFeedback; } set { dataFeedback = value; OnPropertyChanged(); } }
public Func<double, string> DateTimeFormatter { get; set; } = value => value > 0 ? new DateTime((long)value).ToString("HH:mm:ss") : new DateTime((long)DateTime.Now.Ticks).ToString("HH:mm:ss");

public Func<double, string> doubleFormatter { get; set; } = value => value.ToString("F2");



public double AxisStep { get; set; } = TimeSpan.FromSeconds(2).Ticks;
public double AxisUnit { get; set; } = TimeSpan.TicksPerSecond;
}
}

+ 195
- 0
BPASmartClient.Academy/ViewModel/HistoryChart50LViewModel.cs Ver ficheiro

@@ -0,0 +1,195 @@
using BPASmartClient.Academy._50L;
using LiveCharts.Definitions.Charts;
using OxyPlot;
using OxyPlot.Axes;
using OxyPlot.Series;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Shapes;
using System.Diagnostics;
using ThingsGateway.Foundation.Extension.Generic;
using static System.Windows.Forms.LinkLabel;
using System.Windows;

namespace BPASmartClient.Academy.ViewModel
{
internal class HistoryChart50LViewModel : NotifyBase
{
public HistoryChart50LViewModel()
{
LoadNames(SqliteOperate.GetInstance.FindNames(SelectTime));

Select = new BPARelayCommand(() => { LoadNames(SqliteOperate.GetInstance.FindNames(SelectTime)); });

FindProductCommand = new BPARelayCommand(() => { LoadNames(SqliteOperate.GetInstance.FindNames(ProductNum)); });

InspectDataCommand = new BPARelayCommand<string>(s => { OxyInit(s); });

CheckedCommand = new BPARelayCommand<string>(async s =>
{
if (int.TryParse(s, out int index))
{
if (VisStatus.Length == OxyDataModels.Count && index >= 0 && index < VisStatus.Length)
{
IsEnable = false;

await Task.Run(() =>
{
sw.Start();
if (VisStatus[index]) OxyModel.Series.Add(OxyDataModels[index].Line);
else OxyModel.Series.Remove(OxyDataModels[index].Line);
OxyModel.InvalidatePlot(true); //重新加载曲线
IsEnable = true;
Debug.WriteLine(sw.ElapsedMilliseconds);
sw.Restart();
});

}
}
});
}

Stopwatch sw = new Stopwatch();

private void OxyInit(string num)
{
OxyModel.Series.Clear();
OxyDataModels.Clear();
OxyModel = new PlotModel() { Title = num };
OxyDataModels.Add(new OxyDataModel(CreateLine("反应釜温度", OxyColor.Parse("#ff0000"))));
OxyDataModels.Add(new OxyDataModel(CreateLine("反应釜蒸汽压力", OxyColor.Parse("#90ee90"))));
OxyDataModels.Add(new OxyDataModel(CreateLine("反应釜蒸汽流量", OxyColor.Parse("#00bfff"))));
OxyDataModels.Add(new OxyDataModel(CreateLine("冷凝水罐温度", OxyColor.Parse("#ffff00"))));
OxyDataModels.Add(new OxyDataModel(CreateLine("冷凝水罐湿度", OxyColor.Parse("#ffa500"))));
OxyDataModels.Add(new OxyDataModel(CreateLine("负压流量", OxyColor.Parse("#9b30ff"))));
OxyDataModels.Add(new OxyDataModel(CreateLine("称重水罐重量", OxyColor.Parse("#00ffff"))));
OxyDataModels.Add(new OxyDataModel(CreateLine("比例阀实际开度", OxyColor.Parse("#ff00ff"))));
SqliteOperate.GetInstance.QueryableByNum(num).ForEach(item =>
{
OxyDataModels[0].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.Temperature));
OxyDataModels[1].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.SteamPressure));
OxyDataModels[2].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.SteamFlowRate));
OxyDataModels[3].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.CondensateWaterTemperature));
OxyDataModels[4].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.CondensateWaterHumidity));
OxyDataModels[5].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.NegativePressureFlowRate));
OxyDataModels[6].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.WeighingWaterTankWeight));
OxyDataModels[7].dataPoints.Add(new DataPoint(DateTimeAxis.ToDouble(item.Createtime), item.ProportionalValveOpening));
});
OxyDataModels.ForEach(item => { item.AddRange(); });
if (!(OxyModel.Axes.Count > 0))
{
OxyModel.Axes.Add(new DateTimeAxis()
{
Position = OxyPlot.Axes.AxisPosition.Bottom,
Title = "时间",
StringFormat = "hh:mm:ss",
AxislineColor = OxyColor.FromRgb(84, 164, 227)
});
OxyModel.Axes.Add(new LinearAxis()
{
Key = "y1",
Title = "温度/℃\r\n压力/kap\r\n流量/m³",
Position = OxyPlot.Axes.AxisPosition.Left,
LabelFormatter = value => value.ToString(),
AxislineColor = OxyColor.Parse("#9C9C9C"),
AxislineStyle = LineStyle.Solid,
AxislineThickness = 1,
});
}
}

private LineSeries CreateLine(string title, OxyColor fillColor)
{
return new LineSeries()
{
LineStyle = LineStyle.Solid,
Title = title,
MarkerFill = fillColor,
MarkerSize = 2,
LineLegendPosition = LineLegendPosition.End
};
}

private void LoadNames(List<SaveNameData> data)
{
if (data == null) return;
if (data.Count <= 0)
{
MessageNotify.GetInstance.OpenMsg("未查询到有效记录");
return;
}
RecipeCharts.Clear();
data.ForEach(item =>
{
RecipeCharts.Add(new RecipeChart()
{
Num = RecipeCharts.Count + 1,
CreateTime = item.Createtime,
Name = item.ProductNumber
});
});
}

public List<OxyDataModel> OxyDataModels { get; set; } = new List<OxyDataModel>();

public ObservableCollection<RecipeChart> RecipeCharts { get; set; } = new ObservableCollection<RecipeChart>();

public DateTime SelectTime { get { return _mSelectTime; } set { _mSelectTime = value; OnPropertyChanged(); } }
private DateTime _mSelectTime = DateTime.Now;

public string ProductNum { get { return _mProductNum; } set { _mProductNum = value; OnPropertyChanged(); } }
private string _mProductNum;

public PlotModel OxyModel { get { return _mOxyModel; } set { _mOxyModel = value; OnPropertyChanged(); } }
private PlotModel _mOxyModel = new PlotModel();


public bool[] VisStatus { get { return _mVisStatus; } set { _mVisStatus = value; OnPropertyChanged(); } }
private bool[] _mVisStatus = new bool[8];

public bool IsEnable
{
get { return _mIsEnable; }
set
{
_mIsEnable = value;
LoadingVis = value ? Visibility.Collapsed : Visibility.Visible;
OnPropertyChanged();
}
}
private bool _mIsEnable = true;

public Visibility LoadingVis { get { return _mLoadingVis; } set { _mLoadingVis = value; OnPropertyChanged(); } }
private Visibility _mLoadingVis = Visibility.Collapsed;


public BPARelayCommand Select { get; set; }

public BPARelayCommand FindProductCommand { get; set; }

public BPARelayCommand<string> InspectDataCommand { get; set; }

public BPARelayCommand<string> CheckedCommand { get; set; }
}


public class OxyDataModel
{
public LineSeries Line { get; set; } = new LineSeries();

public List<DataPoint> dataPoints { get; set; } = new List<DataPoint>();

public void AddRange()
{
Line.Points.AddRange(dataPoints);
}

public OxyDataModel(LineSeries line)
{
Line = line;
}
}
}

+ 6
- 22
BPASmartClient.Academy/ViewModel/HistoryChartViewModel.cs Ver ficheiro

@@ -45,30 +45,14 @@ namespace BPASmartClient.Academy.ViewModel
}
public class RecipeChart : NotifyBase
{
private int _num;
public int Num { get { return _mNum; } set { _mNum = value; OnPropertyChanged(); } }
private int _mNum;

public int Num
{
get { return _num; }
set { _num = value; OnPropertyChanged(); }
}


private string _name;

public string Name
{
get { return _name; }
set { _name = value; OnPropertyChanged(); }
}

private DateTime _createTime;
public string Name { get { return _mName; } set { _mName = value; OnPropertyChanged(); } }
private string _mName;

public DateTime CreateTime
{
get { return _createTime; }
set { _createTime = value; OnPropertyChanged(); }
}
public DateTime CreateTime { get { return _mCreateTime; } set { _mCreateTime = value; OnPropertyChanged(); } }
private DateTime _mCreateTime;

}
}

+ 0
- 16
BPASmartClient.Academy/ViewModel/ReactionKettle500LViewModel.cs Ver ficheiro

@@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy.ViewModel
{
public class ReactionKettle500LViewModel : NotifyBase
{
private volatile static ReactionKettle500LViewModel _Instance;
public static ReactionKettle500LViewModel GetInstance => _Instance ?? (_Instance = new ReactionKettle500LViewModel());
private ReactionKettle500LViewModel() { }

}
}

+ 16
- 0
BPASmartClient.Academy/ViewModel/ReactionKettle50LViewModel.cs Ver ficheiro

@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BPASmartClient.Academy.ViewModel
{
public class ReactionKettle50LViewModel : NotifyBase
{
private volatile static ReactionKettle50LViewModel _Instance;
public static ReactionKettle50LViewModel GetInstance => _Instance ?? (_Instance = new ReactionKettle50LViewModel());
private ReactionKettle50LViewModel() { }

}
}

+ 13
- 11
BPASmartClient.CustomResource/Pages/Model/MessageNotify.cs Ver ficheiro

@@ -181,6 +181,11 @@ namespace BPASmartClient.CustomResource.Pages.Model
}
PV.infoType.Foreground = PV.TextBlockForeground;

//要设置弹框和主窗体跟随,需要设置弹框的打开位置为默认
PV.Width = MainView.CurrentWidth;
PV.Height = MainView.CurrentHeight;
PV.Left = MainView.LeftLoc;
PV.Top = MainView.TopLoc;
var res = PV.ShowDialog();
result = res == null ? false : (bool)res;
});
@@ -192,8 +197,6 @@ namespace BPASmartClient.CustomResource.Pages.Model

public Notifiaction NotifiactionShow { get; set; } = new Notifiaction();

public Window window { get; set; }

#region 右侧弹框

/// <summary>
@@ -225,14 +228,12 @@ namespace BPASmartClient.CustomResource.Pages.Model
/// <summary>
/// 屏幕右下角信息提示弹窗
/// </summary>
/// <param name="e">弹窗类型:Error、Success、Warm、Info,分别对应不同颜色</param>
/// <param name="title">弹窗消息类型:属性判证、XX告警...</param>
/// <param name="content">弹窗消息内容</param>
/// <param name="kcmbbh">一般为对应目标的目标编号</param>
/// <param name="id">该条消息的ID</param>
public void OpenMsg(EnumPromptType type, string title, string content)
/// <param name="type">弹窗类型:Error、Success、Warm、Info,分别对应不同颜色</param>
/// <param name="title">弹窗消息类型:属性判证、XX告警...</param>
public void OpenMsg(string content, EnumPromptType type = EnumPromptType.Info, string title = "提示")
{
if (window == null) return;
//if (window == null) return;
string text = string.Empty;
if (content != null)
{
@@ -255,14 +256,15 @@ namespace BPASmartClient.CustomResource.Pages.Model
Content = text,//"这条通知不会自动关闭,需要点击关闭按钮",
ContentToolTip = content,
NotifiactionType = type,
window = window
window = Application.Current.MainWindow
});
});
}

#endregion
public void OpenMsg(EnumPromptType type, string title, string content, byte viewcount, int viewtime)
{
if (window == null) return;
//if (window == null) return;
string text = string.Empty;
if (content != null)
{
@@ -286,7 +288,7 @@ namespace BPASmartClient.CustomResource.Pages.Model
ContentToolTip = content,
NotifiactionType = type,
time = viewtime,
window = window
window = Application.Current.MainWindow
});
});
}


+ 14
- 0
BPASmartClient.CustomResource/Pages/View/MainView.xaml.cs Ver ficheiro

@@ -20,6 +20,11 @@ namespace BPASmartClient.CustomResource.Pages.View
/// </summary>
public partial class MainView : Window
{
public static double CurrentWidth { get; set; } = 800d;
public static double CurrentHeight { get; set; } = 500d;
public static double LeftLoc { get; set; } = 0d;
public static double TopLoc { get; set; } = 0d;


public string TitleName { get { return _mTitleName; } set { _mTitleName = value; this.tbTitle.Text = value; } }
private string _mTitleName;
@@ -41,6 +46,15 @@ namespace BPASmartClient.CustomResource.Pages.View
this.WindowState = WindowState.Maximized;
}
if (e.LeftButton == MouseButtonState.Pressed) this.DragMove();
LeftLoc = this.Left;
TopLoc = this.Top;
};
this.SizeChanged += (o, e) =>
{
CurrentWidth = this.Width;
CurrentHeight = this.Height;
LeftLoc = this.Left;
TopLoc = this.Top;
};
}



+ 78
- 72
BPASmartClient.CustomResource/Pages/View/PromptView.xaml Ver ficheiro

@@ -11,7 +11,7 @@
AllowsTransparency="True"
Background="{x:Null}"
Topmost="True"
WindowStartupLocation="CenterScreen"
WindowStartupLocation="CenterOwner"
WindowStyle="None"
mc:Ignorable="d">

@@ -30,82 +30,88 @@
</Style>
</Window.Resources>

<Grid Name="main">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" Stretch="Fill" />
</Grid.Background>
<Grid Background="#bb061c43">
<Grid
Name="main"
Width="400"
Height="200">
<Grid.Background>
<ImageBrush ImageSource="/BPASmartClient.CustomResource;component/Image/弹窗.png" Stretch="Fill" />
</Grid.Background>

<Grid Margin="18,16">
<Button
Width="30"
Height="20"
HorizontalAlignment="Right"
VerticalAlignment="Top"
Background="Transparent"
BorderThickness="0"
Click="Button_Click" />

<Grid Margin="0,40,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.15*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Name="infoType"
Grid.Column="1"
VerticalAlignment="Top"
FontSize="15"
Foreground="DeepSkyBlue" />
<TextBlock
Name="icon"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontFamily="../../Fonts/#iconfont"
FontSize="30"
Foreground="DeepSkyBlue"
Text="&#xe61f;" />
<TextBlock
Name="info"
Grid.Column="2"
Margin="10,0,0,0"
<Grid Margin="18,16">
<Button
Width="30"
Height="20"
HorizontalAlignment="Right"
VerticalAlignment="Top"
FontSize="15"
Foreground="DeepSkyBlue"
Text="警告:"
TextWrapping="Wrap" />
</Grid>
Background="Transparent"
BorderThickness="0"
Click="Button_Click" />

<StackPanel
Grid.Row="1"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Name="Cancel"
Width="90"
Height="30"
Margin="5,0,5,0"
Click="Cancel_Click"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
<Grid Margin="0,40,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.2*" />
<ColumnDefinition Width="0.15*" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<TextBlock
Name="infoType"
Grid.Column="1"
VerticalAlignment="Top"
FontSize="15"
Foreground="DeepSkyBlue" />
<TextBlock
Name="icon"
HorizontalAlignment="Center"
VerticalAlignment="Top"
FontFamily="../../Fonts/#iconfont"
FontSize="30"
Foreground="DeepSkyBlue"
Text="&#xe61f;" />
<TextBlock
Name="info"
Grid.Column="2"
Margin="10,0,0,0"
VerticalAlignment="Top"
FontSize="15"
Foreground="DeepSkyBlue"
Text="警告:"
TextWrapping="Wrap" />
</Grid>

<Button
Name="ok"
Width="90"
Height="30"
Margin="5,0,5,0"
Click="ok_Click"
Content="确定"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>
<StackPanel
Grid.Row="1"
Margin="0,0,10,0"
HorizontalAlignment="Right"
Orientation="Horizontal">
<Button
Name="Cancel"
Width="90"
Height="30"
Margin="5,0,5,0"
Click="Cancel_Click"
Content="取消"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />

<Button
Name="ok"
Width="90"
Height="30"
Margin="5,0,5,0"
Click="ok_Click"
Content="确定"
FontSize="20"
Style="{StaticResource ImageButtonStyle}" />
</StackPanel>

<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.5*" />
</Grid.RowDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="0.5*" />
</Grid.RowDefinitions>
</Grid>
</Grid>
</Grid>

</Window>

+ 1
- 1
BPASmartClient.CustomResource/Pages/View/PromptView.xaml.cs Ver ficheiro

@@ -23,7 +23,7 @@ namespace BPASmartClient.CustomResource.Pages.View
public PromptView()
{
InitializeComponent();
this.main.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
//this.main.MouseLeftButtonDown += (o, e) => { if (e.LeftButton == MouseButtonState.Pressed) this.DragMove(); };
}

public string TextBlockIcon


+ 11
- 11
BPASmartClient.CustomResource/UserControls/DeCanvas/RubberbandAdorner.cs Ver ficheiro

@@ -74,18 +74,18 @@ namespace BPASmartClient.CustomResource.UserControls.DeCanvas
designerCanvas.SelectedItems.Clear();

Rect rubberBand = new Rect(startPoint.Value, endPoint.Value);
foreach (Control item in designerCanvas.Children)
{
Rect itemRect = VisualTreeHelper.GetDescendantBounds(item);
Rect itemBounds = item.TransformToAncestor(designerCanvas).TransformBounds(itemRect);
//foreach (Control item in designerCanvas.Children)
//{
// Rect itemRect = VisualTreeHelper.GetDescendantBounds(item);
// Rect itemBounds = item.TransformToAncestor(designerCanvas).TransformBounds(itemRect);

if (rubberBand.Contains(itemBounds) && item is ISelectable)
{
ISelectable selectableItem = item as ISelectable;
selectableItem.IsSelected = true;
designerCanvas.SelectedItems.Add(selectableItem);
}
}
// if (rubberBand.Contains(itemBounds) && item is ISelectable)
// {
// ISelectable selectableItem = item as ISelectable;
// selectableItem.IsSelected = true;
// designerCanvas.SelectedItems.Add(selectableItem);
// }
//}
}
}
}

Carregando…
Cancelar
Guardar