Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
18196f8619
8 files changed
+343
-16
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using LiveChartsCore.SkiaSharpView;
|
||||
using LiveChartsCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using static DyeingComputer.UserClass.SqliteHelper;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
|
||||
namespace DyeingComputer.ViewModel
|
||||
{
|
||||
public class CurveDiagramViewModel : ObservableObject
|
||||
{
|
||||
|
||||
public ISeries[] Series { get; set; } = new ISeries[]
|
||||
{
|
||||
new LineSeries<double>
|
||||
{
|
||||
Values = new double[] { 2, 1, 3, 5, 3, 4, 6 },
|
||||
Fill = null
|
||||
}
|
||||
};
|
||||
|
||||
public CurveDiagramViewModel()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -56,6 +56,7 @@ namespace DyeingComputer.ViewModel
|
||||
{
|
||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
private readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||
private readonly string ChartAdress = Environment.CurrentDirectory + "\\DataBase\\Chart.db"; //数据库路径
|
||||
private IniFile.IniFiles Configini = new IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "DyeingComputer.ini");
|
||||
private PID pid = new PID();
|
||||
public static DataTable RUN_DATATABLE = new DataTable();//缓存工作表
|
||||
@@ -82,7 +83,6 @@ namespace DyeingComputer.ViewModel
|
||||
private int MT40;//低水位
|
||||
private int MT41;//安全水位
|
||||
private static int MT90;//呼叫操作员
|
||||
|
||||
private int S16;//机型
|
||||
private int SM01;//副缸
|
||||
private int SM02;//副缸
|
||||
@@ -121,6 +121,7 @@ namespace DyeingComputer.ViewModel
|
||||
SM03 = Convert.ToInt16(Selet_sys("SM03"));//FG
|
||||
}
|
||||
DataTable dt_con = new DataTable();
|
||||
DataTable dt_sys = new DataTable();
|
||||
public string Selet_con(string key)//配置缓存
|
||||
{
|
||||
try
|
||||
@@ -135,8 +136,6 @@ namespace DyeingComputer.ViewModel
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
DataTable dt_sys = new DataTable();
|
||||
public string Selet_sys(string key)//配置缓存
|
||||
{
|
||||
try
|
||||
@@ -151,6 +150,7 @@ namespace DyeingComputer.ViewModel
|
||||
return "0";
|
||||
}
|
||||
}
|
||||
|
||||
public string work_Temp; //显示温度
|
||||
public string Work_Temp //通知UI控件参数改变
|
||||
{
|
||||
@@ -226,15 +226,16 @@ namespace DyeingComputer.ViewModel
|
||||
|
||||
if (!SETP_runtime) DIDETime++;
|
||||
|
||||
STEP_RUN();
|
||||
STEP_RUN();
|
||||
LOG_view();
|
||||
IO_view();
|
||||
|
||||
if (!string.IsNullOrEmpty(Name_err.ToString())) Status_Str = Name_err.ToString();
|
||||
}
|
||||
void Tick_Event_5S(object sender, EventArgs e)//Tick_Event周期执行事件5S
|
||||
{
|
||||
{
|
||||
if (!LINK_OK) Modbus_link();
|
||||
Chart();//写入记录
|
||||
|
||||
if (string.IsNullOrEmpty(Name_err.ToString()) && ((Selet_dtm("1010") < 10) || (Selet_dtm("1010") > 160)))
|
||||
{ Name_err = Resources.Temperature + Resources.Sensor + Resources.Malfunction; } //温度故障提示
|
||||
@@ -256,6 +257,28 @@ namespace DyeingComputer.ViewModel
|
||||
}
|
||||
}
|
||||
|
||||
void Chart()
|
||||
{
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
Chart_new.Add("DYELOT", work_Numder);
|
||||
Chart_new.Add("Time", sys_Time);
|
||||
Chart_new.Add("MST", string.Format(" {0:###.#}", TEMP_co));
|
||||
Chart_new.Add("MTT", Selet_dtm("1010"));
|
||||
Chart_new.Add("MTL", Selet_dtm("1015"));
|
||||
Chart_new.Add("MTH", Selet_dtm("1009"));
|
||||
Chart_new.Add("STTA", Selet_dtm("1012"));
|
||||
Chart_new.Add("STLA", Selet_dtm("1017"));
|
||||
Chart_new.Add("STTB", Selet_dtm("1013"));
|
||||
Chart_new.Add("STLB", Selet_dtm("1018"));
|
||||
Chart_new.Add("STTC", Selet_dtm("1014"));
|
||||
Chart_new.Add("STLC", Selet_dtm("1019"));
|
||||
|
||||
SQLiteHelpers = new SQLiteHelper(ChartAdress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.InsertData("Chart", Chart_new);// 执行插入
|
||||
SQLiteHelpers.Close();
|
||||
}//历史记录
|
||||
|
||||
public static int WORK_RUN = 0; //运行状态0停止1暂停2运行
|
||||
private static string STEP_ID = "0";
|
||||
private static double STEP_P1 = 0;
|
||||
@@ -268,7 +291,7 @@ namespace DyeingComputer.ViewModel
|
||||
private static int STEP_TIME = 0; //步骤计时S
|
||||
private static int THL_mode = 0; //温控模式 0保温 1加热 2降
|
||||
private static double TEMP_co = 0; //计算温度
|
||||
private static double TEMP_tar = 16.5; //目标温度
|
||||
private static double TEMP_tar = 0.5; //目标温度
|
||||
private bool Alert_yellow = false; //警报黄灯
|
||||
private bool Alert_red = false; //警报红灯
|
||||
private bool Alert_bell = false; //警报铃声
|
||||
@@ -990,7 +1013,6 @@ namespace DyeingComputer.ViewModel
|
||||
Name_err = "800_SerialPort_Not";
|
||||
}
|
||||
}
|
||||
|
||||
private bool LINK_OK = false;
|
||||
private int LINK_RUN = 0;
|
||||
private int LINK_ERR = 0;
|
||||
|
||||
@@ -26,6 +26,12 @@ namespace DyeingComputer.ViewModel
|
||||
return ServiceLocator.Current.GetInstance<MainWindowViewModel>();
|
||||
}
|
||||
}
|
||||
|
||||
public CurveDiagramViewModel Curve
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServiceLocator.Current.GetInstance<CurveDiagramViewModel>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user