Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
d6eaa41db3
4 files changed
+56
-13
No files matched your search
@@ -181,6 +181,7 @@ namespace DyeingComputer
|
||||
{
|
||||
MainWindowViewModel.WORK_RUN = 0;// 运行时停止键为
|
||||
MainWindowViewModel.DIDETime = 0;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ using TouchSocket.Core;
|
||||
using TouchSocket.Sockets;
|
||||
using DyeingComputer.ViewModel;
|
||||
using System.Runtime.InteropServices;
|
||||
using ScottPlot.Colormaps;
|
||||
|
||||
namespace DyeingComputer.UserClass
|
||||
{/// <summary>
|
||||
@@ -25,14 +26,49 @@ namespace DyeingComputer.UserClass
|
||||
public static async Task Main()
|
||||
{
|
||||
TcpService service = new TcpService();
|
||||
service.Connecting = (client, e) => { return EasyTask.CompletedTask; };//有客户端正在连接
|
||||
service.Connected = (client, e) => { return EasyTask.CompletedTask; };//有客户端成功连接
|
||||
service.Closing = (client, e) => { return EasyTask.CompletedTask; };//有客户端正在断开连接,只有当主动断开时才有效。
|
||||
service.Closed = (client, e) => { return EasyTask.CompletedTask; };//有客户端断开连接
|
||||
service.Received = (client, e) =>
|
||||
{
|
||||
LogGing.LogSQLDATA("800", "TcpServer", "API:"+e.ByteBlock.Span.ToString(Encoding.ASCII));
|
||||
if (e.ByteBlock.Span.ToString(Encoding.ASCII) == "SC800") client.SendAsync(MainWindowViewModel.S01);
|
||||
if (e.ByteBlock.Span.ToString(Encoding.ASCII) == "SC801") client.SendAsync(MainWindowViewModel.S16.ToString());
|
||||
if (e.ByteBlock.Span.ToString(Encoding.ASCII) == "SC802") client.SendAsync(MainWindowViewModel.S03);
|
||||
if (e.ByteBlock.Span.ToString(Encoding.ASCII) == "SC803") client.SendAsync(MainWindowViewModel.S05);
|
||||
if (e.ByteBlock.Span.ToString(Encoding.ASCII) == "SC804") client.SendAsync(MainWindowViewModel.S06);
|
||||
string SYSAPI = e.ByteBlock.Span.ToString(Encoding.ASCII).Substring(0,5);
|
||||
LogGing.LogSQLDATA("800", "TcpServer", "API:"+ SYSAPI);
|
||||
if (SYSAPI == "SC800") client.SendAsync(MainWindowViewModel.S01);
|
||||
if (SYSAPI == "SC801") client.SendAsync(MainWindowViewModel.S16.ToString());
|
||||
if (SYSAPI == "SC802") client.SendAsync(MainWindowViewModel.S03);
|
||||
if (SYSAPI == "SC803") client.SendAsync(MainWindowViewModel.S05);
|
||||
if (SYSAPI == "SC804") client.SendAsync(MainWindowViewModel.S06);
|
||||
if (SYSAPI == "SC810")
|
||||
{
|
||||
|
||||
}
|
||||
if (SYSAPI == "SC820")
|
||||
{
|
||||
|
||||
}
|
||||
if (SYSAPI == "SC830")//当前信息
|
||||
{
|
||||
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
||||
Chart_new.Add("DYELOT", MainWindowViewModel.WorkNumder);
|
||||
Chart_new.Add("Time", MainWindowViewModel.SYSTime);
|
||||
Chart_new.Add("MST", MainWindowViewModel.TEMP_co);
|
||||
Chart_new.Add("MTT", MainWindowViewModel.Selet_dtm("1010"));
|
||||
Chart_new.Add("MTL", MainWindowViewModel.Selet_dtm("1015"));
|
||||
Chart_new.Add("MTH", MainWindowViewModel.Selet_dtm("1009"));
|
||||
Chart_new.Add("MUT", MainWindowViewModel.Selet_dtm("1011"));
|
||||
Chart_new.Add("STTA", MainWindowViewModel.Selet_dtm("1012"));
|
||||
Chart_new.Add("STLA", MainWindowViewModel.Selet_dtm("1017"));
|
||||
Chart_new.Add("STTB", MainWindowViewModel.Selet_dtm("1013"));
|
||||
Chart_new.Add("STLB", MainWindowViewModel.Selet_dtm("1018"));
|
||||
Chart_new.Add("STTC", MainWindowViewModel.Selet_dtm("1014"));
|
||||
Chart_new.Add("STLC", MainWindowViewModel.Selet_dtm("1019"));
|
||||
client.SendAsync(Chart_new.ToJsonString());
|
||||
}
|
||||
if (SYSAPI == "SC851") client.SendAsync(MainWindowViewModel.dt_d.ToJsonString());//数字开关信息
|
||||
if (SYSAPI == "SC852") client.SendAsync(MainWindowViewModel.dt_a.ToJsonString());//寄存器信息
|
||||
if (SYSAPI == "SC853") client.SendAsync(MainWindowViewModel.dt_m.ToJsonString());//缓存信息
|
||||
|
||||
return EasyTask.CompletedTask;
|
||||
};
|
||||
|
||||
@@ -45,7 +81,8 @@ namespace DyeingComputer.UserClass
|
||||
.ConfigurePlugins(a =>
|
||||
{
|
||||
//a.Add<DifferentProtocolPlugin>();
|
||||
}));
|
||||
})
|
||||
);
|
||||
await service.StartAsync();//启动
|
||||
|
||||
LogGing.LogGingDATA("800SREVER:START");
|
||||
|
||||
@@ -48,7 +48,8 @@ namespace DyeingComputer.UserClass
|
||||
}
|
||||
}
|
||||
public static void LogSQLDATA(string NAME, string api, string dat)
|
||||
{if (!sqld)
|
||||
{
|
||||
if (!sqld)
|
||||
{
|
||||
sqld = true;
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
|
||||
@@ -212,6 +212,7 @@ namespace DyeingComputer.ViewModel
|
||||
public static int ViewID = 0;//页面id
|
||||
|
||||
public static object Name_err = "";
|
||||
public static object SYSTime;
|
||||
public static object WorkNumder;
|
||||
public static object Process_step;
|
||||
public static Int32 DIDETime; //空闲计时器
|
||||
@@ -242,7 +243,8 @@ namespace DyeingComputer.ViewModel
|
||||
}//时间周期初始化
|
||||
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
||||
{
|
||||
Sys_Time = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||
SYSTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
|
||||
Sys_Time = SYSTime.ToString();
|
||||
Work_Temp = Selet_dtm("1010") + " ℃";
|
||||
Work_Numder = WorkNumder.ToString();
|
||||
|
||||
@@ -320,10 +322,10 @@ namespace DyeingComputer.ViewModel
|
||||
private static double STEP_P5 = 0;
|
||||
private static bool SETP_runtime = false; //步骤开始
|
||||
private static bool STEP_finish = false; //步骤结束
|
||||
private static int STEP_TIME = 0; //步骤计时S
|
||||
private static int THL_mode = 0; //温控模式 0保温 1加热 2降
|
||||
private static double TEMP_co = 0.5; //计算温度
|
||||
private static double TEMP_tar = 0.5; //目标温度
|
||||
public static int STEP_TIME = 0; //步骤计时S
|
||||
public static int THL_mode = 0; //温控模式 0保温 1加热 2降
|
||||
public static double TEMP_co = 0.5; //计算温度
|
||||
public static double TEMP_tar = 0.5; //目标温度
|
||||
private bool Alert_yellow = false; //警报黄灯
|
||||
private bool Alert_red = false; //警报红灯
|
||||
private bool Alert_bell = false; //警报铃声
|
||||
@@ -651,6 +653,7 @@ namespace DyeingComputer.ViewModel
|
||||
}
|
||||
else
|
||||
{
|
||||
if (temp_time10s == 1) temp_time10s = 2;
|
||||
if ((temp_time10s <= Convert.ToInt16(TO)/100))
|
||||
{ Updata_dtd("3009", true); }
|
||||
else { Updata_dtd("3009", false); }//升温
|
||||
@@ -1360,6 +1363,7 @@ namespace DyeingComputer.ViewModel
|
||||
}//清除输出状态
|
||||
if (string.IsNullOrEmpty(Name_err.ToString()))
|
||||
{
|
||||
WorkNumder = "----------";
|
||||
int TIMEH = DIDETime / 3600;
|
||||
int TIMEM = (DIDETime - TIMEH * 3600) / 60;
|
||||
int TIMES = DIDETime - TIMEH * 3600 - TIMEM * 60;
|
||||
|
||||
Reference in new issue
Block a user