|
|
@ -79,6 +79,7 @@ namespace DyeingComputer.UserClass |
|
|
service.Closed = (client, e) => { return EasyTask.CompletedTask; };//有客户端断开连接
|
|
|
service.Closed = (client, e) => { return EasyTask.CompletedTask; };//有客户端断开连接
|
|
|
service.Received = (client, e) => |
|
|
service.Received = (client, e) => |
|
|
{ |
|
|
{ |
|
|
|
|
|
MainWindowViewModel.RX++; |
|
|
string SYSAPI = e.ByteBlock.Span.ToString(Encoding.ASCII).Substring(0,5); |
|
|
string SYSAPI = e.ByteBlock.Span.ToString(Encoding.ASCII).Substring(0,5); |
|
|
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8).Substring(5); |
|
|
string DAT = e.ByteBlock.Span.ToString(Encoding.UTF8).Substring(5); |
|
|
string SYSDAT ="";// = e.ByteBlock.Span.ToString(Encoding.ASCII).Substring(5);
|
|
|
string SYSDAT ="";// = e.ByteBlock.Span.ToString(Encoding.ASCII).Substring(5);
|
|
|
@ -94,6 +95,7 @@ namespace DyeingComputer.UserClass |
|
|
Chart_new.Add("SYSKEY", MainWindowViewModel.SYSKEY); |
|
|
Chart_new.Add("SYSKEY", MainWindowViewModel.SYSKEY); |
|
|
Chart_new.Add("TIME", MainWindowViewModel.SYSTime); |
|
|
Chart_new.Add("TIME", MainWindowViewModel.SYSTime); |
|
|
client.SendAsync("SC800" + "[" + MainWindowViewModel.S01 + "]" + Chart_new.ToJsonString()); |
|
|
client.SendAsync("SC800" + "[" + MainWindowViewModel.S01 + "]" + Chart_new.ToJsonString()); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
} |
|
|
} |
|
|
else if (SYSAPI == "SC810") |
|
|
else if (SYSAPI == "SC810") |
|
|
{ |
|
|
{ |
|
|
@ -115,7 +117,7 @@ namespace DyeingComputer.UserClass |
|
|
WorkOrder_dat.GetValue("State").ToString(), |
|
|
WorkOrder_dat.GetValue("State").ToString(), |
|
|
WorkOrder_dat.GetValue("ProcessID").ToString()); |
|
|
WorkOrder_dat.GetValue("ProcessID").ToString()); |
|
|
if (!dat_w) { client.SendAsync("SC910"); } |
|
|
if (!dat_w) { client.SendAsync("SC910"); } |
|
|
else { client.SendAsync("SC810" + SYSKEY +SYSDAT); } |
|
|
else { client.SendAsync("SC810" + SYSKEY + SYSDAT); MainWindowViewModel.TX++; } |
|
|
} |
|
|
} |
|
|
catch |
|
|
catch |
|
|
{ |
|
|
{ |
|
|
@ -134,7 +136,7 @@ namespace DyeingComputer.UserClass |
|
|
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<DataTable>(SYSDAT); |
|
|
WorkOrder_dat = SerializeConvert.JsonDeserializeFromString<DataTable>(SYSDAT); |
|
|
bool dat_w = SQLDATA.WorkOderStep(WorkOrder_dat); |
|
|
bool dat_w = SQLDATA.WorkOderStep(WorkOrder_dat); |
|
|
if (!dat_w) { client.SendAsync("SC911"); } |
|
|
if (!dat_w) { client.SendAsync("SC911"); } |
|
|
else { client.SendAsync("SC811" + SYSKEY + SYSDAT); } |
|
|
else { client.SendAsync("SC811" + SYSKEY + SYSDAT); MainWindowViewModel.TX++; } |
|
|
} |
|
|
} |
|
|
catch |
|
|
catch |
|
|
{ |
|
|
{ |
|
|
@ -157,6 +159,7 @@ namespace DyeingComputer.UserClass |
|
|
SetLocalDateTime(dt); |
|
|
SetLocalDateTime(dt); |
|
|
} |
|
|
} |
|
|
client.SendAsync("SC820" + "[" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "]"); |
|
|
client.SendAsync("SC820" + "[" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "]"); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
} |
|
|
} |
|
|
catch { client.SendAsync("SC920"); } |
|
|
catch { client.SendAsync("SC920"); } |
|
|
} |
|
|
} |
|
|
@ -185,7 +188,7 @@ namespace DyeingComputer.UserClass |
|
|
} |
|
|
} |
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE") |
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "CONTINUE") |
|
|
{ |
|
|
{ |
|
|
MainWindowViewModel.WORK_RUN = 2;//暂停
|
|
|
MainWindowViewModel.WORK_RUN = 2;//
|
|
|
} |
|
|
} |
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP") |
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "JUMP") |
|
|
{ |
|
|
{ |
|
|
@ -252,6 +255,7 @@ namespace DyeingComputer.UserClass |
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
|
|
|
|
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
}//插入
|
|
|
}//插入
|
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "EDIT") |
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "EDIT") |
|
|
{ |
|
|
{ |
|
|
@ -294,6 +298,7 @@ namespace DyeingComputer.UserClass |
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
|
|
|
|
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
}//编辑
|
|
|
}//编辑
|
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "DELETE") |
|
|
else if (dat_821.GetValue("INSTRUCTION").ToString() == "DELETE") |
|
|
{ |
|
|
{ |
|
|
@ -322,6 +327,7 @@ namespace DyeingComputer.UserClass |
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
SQLiteHelpers.Close(); //关闭连接
|
|
|
|
|
|
|
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
{ |
|
|
{ |
|
|
@ -336,6 +342,7 @@ namespace DyeingComputer.UserClass |
|
|
{ |
|
|
{ |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
{ |
|
|
{ |
|
|
|
|
|
try { |
|
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
|
|
Dictionary<string, object> Chart_new = new Dictionary<string, object>();//缓存函数
|
|
|
Chart_new.Add("Status", MainWindowViewModel.StatusStr); |
|
|
Chart_new.Add("Status", MainWindowViewModel.StatusStr); |
|
|
Chart_new.Add("Machine", MainWindowViewModel.S01); |
|
|
Chart_new.Add("Machine", MainWindowViewModel.S01); |
|
|
@ -355,14 +362,22 @@ namespace DyeingComputer.UserClass |
|
|
Chart_new.Add("STTC", MainWindowViewModel.Selet_dtm("1014")); |
|
|
Chart_new.Add("STTC", MainWindowViewModel.Selet_dtm("1014")); |
|
|
Chart_new.Add("STLC", MainWindowViewModel.Selet_dtm("1019")); |
|
|
Chart_new.Add("STLC", MainWindowViewModel.Selet_dtm("1019")); |
|
|
client.SendAsync("SC830" + "[" + MainWindowViewModel.S01 + "]" + Chart_new.ToJsonString()); |
|
|
client.SendAsync("SC830" + "[" + MainWindowViewModel.S01 + "]" + Chart_new.ToJsonString()); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
|
|
|
} |
|
|
|
|
|
catch { client.SendAsync("SC931"); } |
|
|
} |
|
|
} |
|
|
else { client.SendAsync("SC999"); } |
|
|
else { client.SendAsync("SC999"); } |
|
|
}//当前信息
|
|
|
}//当前信息
|
|
|
else if (SYSAPI == "SC831") |
|
|
else if (SYSAPI == "SC831") |
|
|
{ |
|
|
{ |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
{ |
|
|
{ |
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString()); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
|
|
|
} |
|
|
|
|
|
catch { client.SendAsync("SC931"); } |
|
|
} |
|
|
} |
|
|
else { client.SendAsync("SC999"); } |
|
|
else { client.SendAsync("SC999"); } |
|
|
}//当前工作表
|
|
|
}//当前工作表
|
|
|
@ -372,40 +387,59 @@ namespace DyeingComputer.UserClass |
|
|
{ |
|
|
{ |
|
|
try |
|
|
try |
|
|
{ client.SendAsync("SC832" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.SYSlog); |
|
|
{ client.SendAsync("SC832" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.SYSlog); |
|
|
} catch (Exception) { } } |
|
|
MainWindowViewModel.TX++; |
|
|
|
|
|
} |
|
|
|
|
|
catch { client.SendAsync("SC932"); } |
|
|
|
|
|
} |
|
|
else { client.SendAsync("SC999"); } |
|
|
else { client.SendAsync("SC999"); } |
|
|
}//当前细节信息
|
|
|
}//当前细节信息
|
|
|
else if (SYSAPI == "SC833") |
|
|
else if (SYSAPI == "SC833") |
|
|
{ |
|
|
{ |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
{ |
|
|
{ |
|
|
|
|
|
try |
|
|
|
|
|
{ |
|
|
client.SendAsync("SC832" + "[" + MainWindowViewModel.S01 + "]" + "sc833"); |
|
|
client.SendAsync("SC832" + "[" + MainWindowViewModel.S01 + "]" + "sc833"); |
|
|
|
|
|
MainWindowViewModel.TX++; |
|
|
|
|
|
} |
|
|
|
|
|
catch { client.SendAsync("SC933"); } |
|
|
} |
|
|
} |
|
|
else { client.SendAsync("SC999"); } |
|
|
else { client.SendAsync("SC999"); } |
|
|
}//当前领料单
|
|
|
}//当前领料单
|
|
|
else if (SYSAPI == "SC851") |
|
|
else if (SYSAPI == "SC851") |
|
|
{ |
|
|
{ |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
{ |
|
|
{ |
|
|
client.SendAsync("SC851" + "[" + MainWindowViewModel.S01 + "]" + JsonConvert.SerializeObject(MainWindowViewModel.dt_d));//数字开关信息
|
|
|
client.SendAsync("SC851" + "[" + MainWindowViewModel.S01 + "]" + JsonConvert.SerializeObject(MainWindowViewModel.dt_d));//数字开关信息
|
|
|
} |
|
|
} |
|
|
|
|
|
catch { client.SendAsync("SC951"); } |
|
|
|
|
|
} |
|
|
else { client.SendAsync("SC999"); } |
|
|
else { client.SendAsync("SC999"); } |
|
|
}//数字开关表
|
|
|
}//数字开关表
|
|
|
else if (SYSAPI == "SC852") |
|
|
else if (SYSAPI == "SC852") |
|
|
{ |
|
|
{ |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
{ |
|
|
{ |
|
|
client.SendAsync("SC852" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_a.ToJsonString());//寄存器信息
|
|
|
client.SendAsync("SC852" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_a.ToJsonString());//寄存器信息
|
|
|
} |
|
|
} |
|
|
|
|
|
catch { client.SendAsync("SC952"); } |
|
|
|
|
|
} |
|
|
else { client.SendAsync("SC999"); } |
|
|
else { client.SendAsync("SC999"); } |
|
|
}//寄存器表
|
|
|
}//寄存器表
|
|
|
else if (SYSAPI == "SC853") |
|
|
else if (SYSAPI == "SC853") |
|
|
{ |
|
|
{ |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
if (SYSKEY == MainWindowViewModel.SYSKEY) |
|
|
|
|
|
{ |
|
|
|
|
|
try |
|
|
{ |
|
|
{ |
|
|
client.SendAsync("SC853" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_m.ToJsonString());//缓存信息
|
|
|
client.SendAsync("SC853" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_m.ToJsonString());//缓存信息
|
|
|
} |
|
|
} |
|
|
|
|
|
catch { client.SendAsync("SC953"); } |
|
|
|
|
|
} |
|
|
else { client.SendAsync("SC999"); } |
|
|
else { client.SendAsync("SC999"); } |
|
|
}//缓存表
|
|
|
}//缓存表
|
|
|
|
|
|
|
|
|
|