网络功能添加错误状态返回
This commit is contained in:
commit
409fc84191
2 files changed
+51
-42
No files matched your search
+37
-21
@@ -25,6 +25,7 @@ using DyeingComputer.View;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using static System.Net.WebRequestMethods;
|
||||
using System.Collections;
|
||||
|
||||
namespace DyeingComputer.UserClass
|
||||
{/// <summary>
|
||||
@@ -67,6 +68,8 @@ namespace DyeingComputer.UserClass
|
||||
return rt;
|
||||
}
|
||||
|
||||
|
||||
public static string[] Prohibit = new string[10] { "S01", "S02", "S03", "S05", "S06", "S07", "SL1", "SL2", "SL3", ""};//禁止操作的指令
|
||||
public static SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||
public static readonly string DBAddress = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db"; //数据库路径
|
||||
public static async Task Main()
|
||||
@@ -167,7 +170,7 @@ namespace DyeingComputer.UserClass
|
||||
client.SendAsync("SC820" + "[" + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss") + "]");
|
||||
MainWindowViewModel.TX++;
|
||||
}
|
||||
catch { client.SendAsync("SC920"); }
|
||||
catch (Exception ex) { client.SendAsync("SC920" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//设置系统时间
|
||||
@@ -348,7 +351,7 @@ namespace DyeingComputer.UserClass
|
||||
client.SendAsync("SC821" + SYSKEY + SYSDAT);
|
||||
}
|
||||
}
|
||||
catch { client.SendAsync("SC921"); }
|
||||
catch (Exception ex) { client.SendAsync("SC921" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//启停跳步指令
|
||||
@@ -378,7 +381,7 @@ namespace DyeingComputer.UserClass
|
||||
client.SendAsync("SC830" + "[" + MainWindowViewModel.S01 + "]" + Chart_new.ToJsonString());
|
||||
MainWindowViewModel.TX++;
|
||||
}
|
||||
catch { client.SendAsync("SC931"); }
|
||||
catch (Exception ex) { client.SendAsync("SC931" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//当前信息
|
||||
@@ -391,7 +394,7 @@ namespace DyeingComputer.UserClass
|
||||
client.SendAsync("SC831" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_TP.ToJsonString());
|
||||
MainWindowViewModel.TX++;
|
||||
}
|
||||
catch { client.SendAsync("SC931"); }
|
||||
catch (Exception ex) { client.SendAsync("SC931" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//当前工作表
|
||||
@@ -403,7 +406,7 @@ namespace DyeingComputer.UserClass
|
||||
{ client.SendAsync("SC832" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.SYSlog);
|
||||
MainWindowViewModel.TX++;
|
||||
}
|
||||
catch { client.SendAsync("SC932"); }
|
||||
catch (Exception ex) { client.SendAsync("SC932" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//当前细节信息
|
||||
@@ -416,7 +419,7 @@ namespace DyeingComputer.UserClass
|
||||
client.SendAsync("SC832" + "[" + MainWindowViewModel.S01 + "]" + "sc833");
|
||||
MainWindowViewModel.TX++;
|
||||
}
|
||||
catch { client.SendAsync("SC933"); }
|
||||
catch (Exception ex) { client.SendAsync("SC933" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//当前领料单
|
||||
@@ -428,7 +431,7 @@ namespace DyeingComputer.UserClass
|
||||
{
|
||||
client.SendAsync("SC851" + "[" + MainWindowViewModel.S01 + "]" + JsonConvert.SerializeObject(MainWindowViewModel.dt_d));//数字开关信息
|
||||
}
|
||||
catch { client.SendAsync("SC951"); }
|
||||
catch (Exception ex) { client.SendAsync("SC951" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//数字开关表
|
||||
@@ -440,7 +443,7 @@ namespace DyeingComputer.UserClass
|
||||
{
|
||||
client.SendAsync("SC852" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_a.ToJsonString());//寄存器信息
|
||||
}
|
||||
catch { client.SendAsync("SC952"); }
|
||||
catch (Exception ex) { client.SendAsync("SC952" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//寄存器表
|
||||
@@ -452,7 +455,7 @@ namespace DyeingComputer.UserClass
|
||||
{
|
||||
client.SendAsync("SC853" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_m.ToJsonString());//缓存信息
|
||||
}
|
||||
catch { client.SendAsync("SC953"); }
|
||||
catch (Exception ex) { client.SendAsync("SC953" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//缓存表
|
||||
@@ -464,7 +467,7 @@ namespace DyeingComputer.UserClass
|
||||
{
|
||||
client.SendAsync("SC854" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_ParameterSet.ToJsonString());//缓存信息
|
||||
}
|
||||
catch { client.SendAsync("SC954"); }
|
||||
catch (Exception ex) { client.SendAsync("SC954" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//程序设置表
|
||||
@@ -476,7 +479,7 @@ namespace DyeingComputer.UserClass
|
||||
{
|
||||
client.SendAsync("SC855" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_SysSet.ToJsonString());//缓存信息
|
||||
}
|
||||
catch { client.SendAsync("SC955"); }
|
||||
catch (Exception ex) { client.SendAsync("SC955" + "[" + MainWindowViewModel.S01 + "]" + ex); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//系统设置表
|
||||
@@ -500,7 +503,10 @@ namespace DyeingComputer.UserClass
|
||||
|
||||
client.SendAsync("SC854" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_ParameterSet.ToJsonString());//缓存信息
|
||||
}
|
||||
catch { client.SendAsync("SC961"); }
|
||||
catch (Exception ex)
|
||||
{
|
||||
client.SendAsync("SC961" + "[" + MainWindowViewModel.S01 + "]" + ex);
|
||||
}
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//修改软件设置
|
||||
@@ -513,18 +519,28 @@ namespace DyeingComputer.UserClass
|
||||
Dictionary<string, object> dat_862;
|
||||
dat_862 = SerializeConvert.JsonDeserializeFromString<Dictionary<string, object>>(SYSDAT);
|
||||
|
||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||
datagrid_v.Add("Value", dat_862.GetValue("Value"));
|
||||
if (((IList)Prohibit).Contains(dat_862.GetValue("ID")))//是否允许操作
|
||||
{
|
||||
client.SendAsync("SC980" + "[" + MainWindowViewModel.S01 + "]" + "Settings that are not allowed to be modified remotely");
|
||||
}
|
||||
else
|
||||
{
|
||||
Dictionary<string, object> datagrid_v = new Dictionary<string, object>();//缓存函数
|
||||
datagrid_v.Add("Value", dat_862.GetValue("Value"));
|
||||
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Update("System", datagrid_v, "ParameterID ='" + dat_862.GetValue("ID") + "'", null);//更新
|
||||
MainWindowViewModel.dt_SysSet = SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0];
|
||||
SQLiteHelpers.Close();//关闭数据库
|
||||
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
||||
SQLiteHelpers.Open(); //打开数据库
|
||||
SQLiteHelpers.Update("System", datagrid_v, "ParameterID ='" + dat_862.GetValue("ID") + "'", null);//更新
|
||||
MainWindowViewModel.dt_SysSet = SQLiteHelpers.ExecuteDataSet("select * from System order by ParameterID asc", null).Tables[0];
|
||||
SQLiteHelpers.Close();//关闭数据库
|
||||
|
||||
client.SendAsync("SC855" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_SysSet.ToJsonString());//缓存信息
|
||||
client.SendAsync("SC855" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_SysSet.ToJsonString());//缓存信息
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
client.SendAsync("SC962" + "[" + MainWindowViewModel.S01 + "]" + ex);
|
||||
}
|
||||
catch { client.SendAsync("SC962"); }
|
||||
}
|
||||
else { client.SendAsync("SC999"); }
|
||||
}//修改系统
|
||||
|
||||
Reference in new issue
Block a user