diff --git a/ClientsLibrary/FormLogView.Designer.cs b/ClientsLibrary/FormLogView.Designer.cs index 3f0d27b..c4a79e0 100644 --- a/ClientsLibrary/FormLogView.Designer.cs +++ b/ClientsLibrary/FormLogView.Designer.cs @@ -54,10 +54,9 @@ this.logNetAnalysisControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.logNetAnalysisControl1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.logNetAnalysisControl1.Location = new System.Drawing.Point(8, 8); + this.logNetAnalysisControl1.Location = new System.Drawing.Point(8, 7); this.logNetAnalysisControl1.Name = "logNetAnalysisControl1"; - this.logNetAnalysisControl1.Size = new System.Drawing.Size(783, 693); + this.logNetAnalysisControl1.Size = new System.Drawing.Size(785, 696); this.logNetAnalysisControl1.TabIndex = 47; this.logNetAnalysisControl1.Load += new System.EventHandler(this.logNetAnalysisControl1_Load); // diff --git a/ClientsLibrary/FormRegisterAccount.Designer.cs b/ClientsLibrary/FormRegisterAccount.Designer.cs index a8d0927..9cf21ae 100644 --- a/ClientsLibrary/FormRegisterAccount.Designer.cs +++ b/ClientsLibrary/FormRegisterAccount.Designer.cs @@ -34,15 +34,15 @@ namespace ClientsLibrary this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label2 = new System.Windows.Forms.Label(); - this.textBox3 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.label4 = new System.Windows.Forms.Label(); this.label5 = new System.Windows.Forms.Label(); this.textBox4 = new System.Windows.Forms.TextBox(); this.label6 = new System.Windows.Forms.Label(); - this.userButton_login = new UserButton(); + this.userButton_login = new HslCommunication.Controls.UserButton(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.comboBox_factory = new System.Windows.Forms.ComboBox(); this.SuspendLayout(); // // label1 @@ -77,13 +77,6 @@ namespace ClientsLibrary this.label2.TabIndex = 2; this.label2.Text = "密码:"; // - // textBox3 - // - this.textBox3.Location = new System.Drawing.Point(98, 87); - this.textBox3.Name = "textBox3"; - this.textBox3.Size = new System.Drawing.Size(232, 23); - this.textBox3.TabIndex = 5; - // // label3 // this.label3.AutoSize = true; @@ -159,11 +152,21 @@ namespace ClientsLibrary this.comboBox2.Size = new System.Drawing.Size(232, 25); this.comboBox2.TabIndex = 14; // + // comboBox_factory + // + this.comboBox_factory.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox_factory.FormattingEnabled = true; + this.comboBox_factory.Location = new System.Drawing.Point(98, 86); + this.comboBox_factory.Name = "comboBox_factory"; + this.comboBox_factory.Size = new System.Drawing.Size(232, 25); + this.comboBox_factory.TabIndex = 15; + // // FormRegisterAccount // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(382, 342); + this.Controls.Add(this.comboBox_factory); this.Controls.Add(this.comboBox2); this.Controls.Add(this.comboBox1); this.Controls.Add(this.userButton_login); @@ -171,7 +174,6 @@ namespace ClientsLibrary this.Controls.Add(this.label6); this.Controls.Add(this.label5); this.Controls.Add(this.label4); - this.Controls.Add(this.textBox3); this.Controls.Add(this.label3); this.Controls.Add(this.textBox2); this.Controls.Add(this.label2); @@ -197,7 +199,6 @@ namespace ClientsLibrary private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox2; private System.Windows.Forms.Label label2; - private System.Windows.Forms.TextBox textBox3; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label4; private System.Windows.Forms.Label label5; @@ -206,5 +207,6 @@ namespace ClientsLibrary private UserButton userButton_login; private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.ComboBox comboBox_factory; } } \ No newline at end of file diff --git a/ClientsLibrary/FormRegisterAccount.cs b/ClientsLibrary/FormRegisterAccount.cs index 90d6e67..5659ada 100644 --- a/ClientsLibrary/FormRegisterAccount.cs +++ b/ClientsLibrary/FormRegisterAccount.cs @@ -14,13 +14,25 @@ namespace ClientsLibrary { public partial class FormRegisterAccount : Form { - public FormRegisterAccount() + /// + /// 实例化对象 + /// + /// + /// + public FormRegisterAccount(string[] factories) { InitializeComponent(); net_client = UserClient.Net_simplify_client; + Factories = new List(factories); + + + // 根据自身需求是否添加总公司名称 + Factories.Add("总公司"); } - + + private List Factories = null; + private void FormRegisterAccount_Load(object sender, EventArgs e) { comboBox1.DataSource = AccountGrade.GetDescription(); @@ -29,6 +41,8 @@ namespace ClientsLibrary comboBox1.SelectedItem = AccountGrade.GetDescription(AccountGrade.Technology); comboBox2.SelectedItem = "允许"; + comboBox_factory.DataSource = Factories.ToArray(); + textBox4.Text = (new UserAccount()).ForbidMessage; } @@ -36,11 +50,11 @@ namespace ClientsLibrary private void userButton_login_Click(object sender, EventArgs e) { - //点击了注册,先获取数据 + // 点击了注册,先获取数据 UserAccount account = new UserAccount(); account.UserName = textBox1.Text; account.Password = textBox2.Text; - account.Factory = textBox3.Text; + account.Factory = comboBox_factory.SelectedItem.ToString(); switch (comboBox1.SelectedIndex) { case 0: account.Grade = AccountGrade.SuperAdministrator; break; diff --git a/ClientsLibrary/UserClient.cs b/ClientsLibrary/UserClient.cs index a5a7994..66e8335 100644 --- a/ClientsLibrary/UserClient.cs +++ b/ClientsLibrary/UserClient.cs @@ -9,9 +9,14 @@ using CommonLibrary; namespace ClientsLibrary { - //==================================================================================================== - // 模版说明: - //==================================================================================================== + + /*********************************************************************************** + * + * 说明:用来存储客户端全局的变量数据,好在任何界面都可以直达数据 + * + * + ***********************************************************************************/ + /// /// 一个通用的用户客户端类 @@ -19,16 +24,31 @@ namespace ClientsLibrary public class UserClient { public static JsonSettings JsonSettings = new JsonSettings(); + + + /// /// 本软件的当前版本,用来验证更新的关键依据 /// public static SystemVersion CurrentVersion { get; } = new SystemVersion("1.0.0"); + + /// - /// 服务器的IP地址,默认为127.0.0.1,可用于单机调试,云端:117.48.203.204 + /// 服务器的IP地址,默认为127.0.0.1,可用于单机调试,云服务器端:117.48.203.204 /// public static string ServerIp { get; } = "127.0.0.1";//用于测试的云服务器地址 + + + /// + /// 系统的分厂信息 + /// + public static List SystemFactories { get; set; } = new List(); + + + + /// /// 所有版本更新信息的对象 /// @@ -39,7 +59,8 @@ namespace ClientsLibrary { VersionNum=new SystemVersion("1.0.0"), ReleaseDate=new DateTime(2017,1,1),//该版本发布的日期 - UpdateDetails=new StringBuilder("1.本系统第一版本正式发布使用。"+Environment.NewLine+ + UpdateDetails=new StringBuilder( + "1.本系统第一版本正式发布使用。"+Environment.NewLine+ "2.提供了多客户端用时在线的功能。"+Environment.NewLine+ "3.需要用户自行添加"), }, @@ -85,6 +106,12 @@ namespace ClientsLibrary }; + + /// + /// 用来处理客户端发生的未捕获的异常,将通过网络组件发送至服务器存储,用于更好的跟踪错误 + /// + /// + /// public static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { if (e.ExceptionObject is Exception ex) diff --git a/CommonLibrary/BasicSupport/SoftSettings.cs b/CommonLibrary/BasicSupport/SoftSettings.cs index 38f06f7..062d572 100644 --- a/CommonLibrary/BasicSupport/SoftSettings.cs +++ b/CommonLibrary/BasicSupport/SoftSettings.cs @@ -6,10 +6,33 @@ using Newtonsoft.Json.Linq; using System.IO; using HslCommunication.BasicFramework; -//2017-02-10 + + + +/************************************************************************************* + * + * 时间:2017年9月3日 09:18:21 + * 说明:本文档主要包含一个主要内容,关于客户端和服务器的一些本地参数存储解析 + * + * 服务器:此处存储了系统版本号,公告,是否允许用户登录,分厂信息等等共享 + * 客户端:此处存储了用户名,密码,上次登录时间,机器码等等,用于客户端自我校验 + * + * 格式:存储采用json字符串存储,客户端还进行了双向加密,防止用户直接打开更改 + * + *************************************************************************************/ + + + + + + + + namespace CommonLibrary { + + /// /// 服务器的常用参数保存,包含了版本号,公告,是否允许登录,不能登录说明 /// @@ -33,6 +56,15 @@ namespace CommonLibrary /// 不允许登录系统的原因 /// public string Account_Forbidden_Reason { get; set; } = "系统处于维护中,请稍后登录。"; + /// + /// 系统的所属分厂 + /// + public List SystemFactories { get; set; } = new List(); + + + + + /// /// 获取需要存储的数据 @@ -45,7 +77,8 @@ namespace CommonLibrary { nameof(SystemVersion), new JValue(SystemVersion.ToString()) }, { nameof(Announcement), new JValue(Announcement) }, { nameof(Can_Account_Login), new JValue(Can_Account_Login) }, - { nameof(Account_Forbidden_Reason), new JValue(Account_Forbidden_Reason) } + { nameof(Account_Forbidden_Reason), new JValue(Account_Forbidden_Reason) }, + { nameof(SystemFactories), new JArray(SystemFactories) } }; return json.ToString(); } @@ -60,6 +93,7 @@ namespace CommonLibrary Announcement = json.Property(nameof(Announcement)).Value.Value(); Can_Account_Login = SoftBasic.GetValueFromJsonObject(json, nameof(Can_Account_Login), Can_Account_Login); Account_Forbidden_Reason = SoftBasic.GetValueFromJsonObject(json, nameof(Account_Forbidden_Reason), Account_Forbidden_Reason); + SystemFactories = JArray.Parse(SoftBasic.GetValueFromJsonObject(json, nameof(SystemFactories), "[]")).ToObject>(); } } diff --git a/CommonLibrary/HeadCode.cs b/CommonLibrary/HeadCode.cs index 45ca7df..4d76bf2 100644 --- a/CommonLibrary/HeadCode.cs +++ b/CommonLibrary/HeadCode.cs @@ -59,6 +59,9 @@ namespace CommonLibrary public static int 下载小头 { get; } = 10016; public static int 请求大头 { get; } = 10017; public static int 下载大头 { get; } = 10018; + public static int 请求分厂 { get; } = 10019; + public static int 上传分厂 { get; } = 10020; + diff --git a/软件系统客户端Wpf/MainWindow.xaml b/软件系统客户端Wpf/MainWindow.xaml index a27a119..c2b4e8f 100644 --- a/软件系统客户端Wpf/MainWindow.xaml +++ b/软件系统客户端Wpf/MainWindow.xaml @@ -62,6 +62,11 @@ + + + + + diff --git a/软件系统客户端Wpf/MainWindow.xaml.cs b/软件系统客户端Wpf/MainWindow.xaml.cs index e6b8e7e..73b7c32 100644 --- a/软件系统客户端Wpf/MainWindow.xaml.cs +++ b/软件系统客户端Wpf/MainWindow.xaml.cs @@ -123,6 +123,7 @@ namespace 软件系统客户端Wpf MenuItem注册账户.IsEnabled = false; MenuItem消息发送.IsEnabled = false; MenuItem开发中心.IsEnabled = false; + MenuItem分厂配置.IsEnabled = false; } @@ -211,7 +212,7 @@ namespace 软件系统客户端Wpf private void MenuItem注册账户_Click(object sender, RoutedEventArgs e) { - using (FormRegisterAccount fra = new FormRegisterAccount()) + using (FormRegisterAccount fra = new FormRegisterAccount(UserClient.SystemFactories.ToArray())) { fra.ShowDialog(); } @@ -370,6 +371,18 @@ namespace 软件系统客户端Wpf } + private void MenuItem分厂配置_Click(object sender, RoutedEventArgs e) + { + using (FormInputAndAction fiaa = new FormInputAndAction( + str => UserClient.Net_simplify_client.ReadFromServer( + CommonHeadCode.SimplifyHeadCode.上传分厂, str).IsSuccess, + JArray.FromObject(UserClient.SystemFactories).ToString(), + "请按照JSON格式更新分厂信息,然后提交:")) + { + fiaa.ShowDialog(); + } + } + #endregion @@ -756,5 +769,7 @@ namespace 软件系统客户端Wpf await Task.Delay(2000); DialogHostWait.IsOpen = false; } + + } } diff --git a/软件系统客户端模版/FormLogin.cs b/软件系统客户端模版/FormLogin.cs index 892f5c1..dd5caa5 100644 --- a/软件系统客户端模版/FormLogin.cs +++ b/软件系统客户端模版/FormLogin.cs @@ -145,14 +145,14 @@ namespace 软件系统客户端模版 /// private void ThreadCheckAccount() { - //定义委托 + // 定义委托 Action message_show = delegate (string message) { label_status.Text = message; }; Action start_update = delegate { - //需要该exe支持,否则将无法是实现自动版本控制 + // 需要该exe支持,否则将无法是实现自动版本控制 string update_file_name = Application.StartupPath + @"\软件自动更新.exe"; try { @@ -169,15 +169,15 @@ namespace 软件系统客户端模版 UISettings(true); }; - //延时 + // 延时 Thread.Sleep(200); - //请求指令头数据,该数据需要更具实际情况更改 + // 请求指令头数据,该数据需要更具实际情况更改 OperateResultString result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.维护检查); if(result.IsSuccess) { byte[] temp = Encoding.Unicode.GetBytes(result.Content); - //例如返回结果为1说明允许登录,0则说明服务器处于维护中,并将信息显示 + // 例如返回结果为1说明允许登录,0则说明服务器处于维护中,并将信息显示 if (result.Content != "1") { if (IsHandleCreated) Invoke(message_show, result.Content.Substring(1)); @@ -187,7 +187,7 @@ namespace 软件系统客户端模版 } else { - //访问失败 + // 访问失败 if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(thread_finish); return; @@ -195,18 +195,18 @@ namespace 软件系统客户端模版 - //检查账户 + // 检查账户 if (IsHandleCreated) Invoke(message_show, "正在检查账户..."); else return; - //延时 + // 延时 Thread.Sleep(200); //=================================================================================== // 根据实际情况校验,选择数据库校验或是将用户名密码发至服务器校验 // 以下展示了服务器校验的方法,如您需要数据库校验,请删除下面并改成SQL访问验证的方式 - //包装数据 + // 包装数据 JObject json = new JObject { { UserAccount.UserNameText, new JValue(textBox_userName.Text) }, @@ -216,11 +216,11 @@ namespace 软件系统客户端模版 result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.账户检查, json.ToString()); if (result.IsSuccess) { - //服务器应该返回账户的信息 + // 服务器应该返回账户的信息 UserAccount account = JObject.Parse(result.Content).ToObject(); if(!account.LoginEnable) { - //不允许登录 + // 不允许登录 if (IsHandleCreated) Invoke(message_show, account.ForbidMessage); if (IsHandleCreated) Invoke(thread_finish); return; @@ -229,40 +229,40 @@ namespace 软件系统客户端模版 } else { - //访问失败 + // 访问失败 if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(thread_finish); return; } - //登录成功,进行保存用户名称和密码 + // 登录成功,进行保存用户名称和密码 UserClient.JsonSettings.LoginName = textBox_userName.Text; UserClient.JsonSettings.Password = checkBox_remeber.Checked ? textBox_password.Text : ""; UserClient.JsonSettings.LoginTime = DateTime.Now; UserClient.JsonSettings.SaveToFile(); - //版本验证 + // 版本验证 if (IsHandleCreated) Invoke(message_show, "正在验证版本..."); else return; - //延时 + // 延时 Thread.Sleep(200); result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.更新检查); if (result.IsSuccess) { - //服务器应该返回服务器的版本号 + // 服务器应该返回服务器的版本号 SystemVersion sv = new SystemVersion(result.Content); - //系统账户跳过低版本检测 + // 系统账户跳过低版本检测,该做法存在一定的风险,需要开发者仔细确认安全隐患 if (UserClient.UserAccount.UserName != "admin") { if (UserClient.CurrentVersion != sv) { - //保存新版本信息 + // 保存新版本信息 UserClient.JsonSettings.IsNewVersionRunning = true; UserClient.JsonSettings.SaveToFile(); - //和当前系统版本号不一致,启动更新 + // 和当前系统版本号不一致,启动更新 if (IsHandleCreated) Invoke(start_update); return; } @@ -271,10 +271,10 @@ namespace 软件系统客户端模版 { if (UserClient.CurrentVersion < sv) { - //保存新版本信息 + // 保存新版本信息 UserClient.JsonSettings.IsNewVersionRunning = true; UserClient.JsonSettings.SaveToFile(); - //和当前系统版本号不一致,启动更新 + // 和当前系统版本号不一致,启动更新 if (IsHandleCreated) Invoke(start_update); return; } @@ -282,42 +282,46 @@ namespace 软件系统客户端模版 } else { - //访问失败 + // 访问失败 if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(thread_finish); return; } - //================================================================================ - //验证结束后,根据需要是否下载服务器的数据,或是等到进入主窗口下载也可以 - //如果有参数决定主窗口的显示方式,那么必要在下面向服务器请求数据 - //以下展示了初始化参数的功能 + // + // 验证结束后,根据需要是否下载服务器的数据,或是等到进入主窗口下载也可以 + // 如果有参数决定主窗口的显示方式,那么必要在下面向服务器请求数据 + // 以下展示了初始化参数的功能 + if (IsHandleCreated) Invoke(message_show, "正在下载参数..."); else return; - //延时 + // 延时 Thread.Sleep(200); result = UserClient.Net_simplify_client.ReadFromServer(CommonLibrary.CommonHeadCode.SimplifyHeadCode.参数下载); if(result.IsSuccess) { - //服务器返回初始化的数据,此处进行数据的提取,有可能包含了多个数据 - json = Newtonsoft.Json.Linq.JObject.Parse(result.Content); - //例如公告数据 + // 服务器返回初始化的数据,此处进行数据的提取,有可能包含了多个数据 + json = JObject.Parse(result.Content); + // 例如公告数据 UserClient.Announcement = SoftBasic.GetValueFromJsonObject(json, nameof(UserClient.Announcement), ""); - + if (json[nameof(UserClient.SystemFactories)] != null) + { + UserClient.SystemFactories = json[nameof(UserClient.SystemFactories)].ToObject>(); + } } else { - //访问失败 + // 访问失败 if (IsHandleCreated) Invoke(message_show, result.Message); if (IsHandleCreated) Invoke(thread_finish); return; } - //启动主窗口 + // 启动主窗口 if (IsHandleCreated) Invoke(new Action(() => { DialogResult = DialogResult.OK; diff --git a/软件系统客户端模版/FormMainWindow.Designer.cs b/软件系统客户端模版/FormMainWindow.Designer.cs index 334e204..aee772e 100644 --- a/软件系统客户端模版/FormMainWindow.Designer.cs +++ b/软件系统客户端模版/FormMainWindow.Designer.cs @@ -79,6 +79,7 @@ this.label10 = new System.Windows.Forms.Label(); this.panel_main = new System.Windows.Forms.Panel(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); + this.分厂配置ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.statusStrip1.SuspendLayout(); this.menuStrip1.SuspendLayout(); this.panel_right.SuspendLayout(); @@ -170,7 +171,8 @@ this.远程更新ToolStripMenuItem, this.注册账号ToolStripMenuItem, this.消息发送ToolStripMenuItem, - this.开发中心ToolStripMenuItem}); + this.开发中心ToolStripMenuItem, + this.分厂配置ToolStripMenuItem}); this.管理员ToolStripMenuItem.Image = global::软件系统客户端模版.Properties.Resources.Team_32xLG; this.管理员ToolStripMenuItem.Name = "管理员ToolStripMenuItem"; this.管理员ToolStripMenuItem.Size = new System.Drawing.Size(100, 31); @@ -557,6 +559,13 @@ this.pictureBox1.TabStop = false; this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click); // + // 分厂配置ToolStripMenuItem + // + this.分厂配置ToolStripMenuItem.Name = "分厂配置ToolStripMenuItem"; + this.分厂配置ToolStripMenuItem.Size = new System.Drawing.Size(164, 32); + this.分厂配置ToolStripMenuItem.Text = "分厂配置"; + this.分厂配置ToolStripMenuItem.Click += new System.EventHandler(this.分厂配置ToolStripMenuItem_Click); + // // FormMainWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); @@ -643,6 +652,7 @@ private System.Windows.Forms.ToolStripMenuItem 开发中心ToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem 更换头像ToolStripMenuItem; private System.Windows.Forms.PictureBox pictureBox1; + private System.Windows.Forms.ToolStripMenuItem 分厂配置ToolStripMenuItem; } } diff --git a/软件系统客户端模版/FormMainWindow.cs b/软件系统客户端模版/FormMainWindow.cs index 90b4c33..75a7656 100644 --- a/软件系统客户端模版/FormMainWindow.cs +++ b/软件系统客户端模版/FormMainWindow.cs @@ -116,6 +116,7 @@ namespace 软件系统客户端模版 注册账号ToolStripMenuItem.Enabled = false; 消息发送ToolStripMenuItem.Enabled = false; 开发中心ToolStripMenuItem.Enabled = false; + 分厂配置ToolStripMenuItem.Enabled = false; } //启动定时器 TimeTickInitilization(); @@ -209,7 +210,7 @@ namespace 软件系统客户端模版 private void 注册账号ToolStripMenuItem_Click(object sender, EventArgs e) { - using (FormRegisterAccount fra = new FormRegisterAccount()) + using (FormRegisterAccount fra = new FormRegisterAccount(UserClient.SystemFactories.ToArray())) { fra.ShowDialog(); } @@ -305,6 +306,18 @@ namespace 软件系统客户端模版 SoftUserPortrait.ChangePortrait(); } + private void 分厂配置ToolStripMenuItem_Click(object sender, EventArgs e) + { + using (FormInputAndAction fiaa = new FormInputAndAction( + str => UserClient.Net_simplify_client.ReadFromServer( + CommonHeadCode.SimplifyHeadCode.上传分厂, str).IsSuccess, + JArray.FromObject(UserClient.SystemFactories).ToString(), + "请按照JSON格式更新分厂信息,然后提交:")) + { + fiaa.ShowDialog(); + } + } + #endregion #region 异步网络块 @@ -644,7 +657,8 @@ namespace 软件系统客户端模版 fmr.ShowDialog(); } } - + + #endregion diff --git a/软件系统服务端模版/FormServerWindow.cs b/软件系统服务端模版/FormServerWindow.cs index 211f41f..13a8739 100644 --- a/软件系统服务端模版/FormServerWindow.cs +++ b/软件系统服务端模版/FormServerWindow.cs @@ -474,7 +474,7 @@ namespace 软件系统服务端模版 { if (customer == CommonHeadCode.SimplifyHeadCode.维护检查) { - net_simplify_server.SendMessage(state, customer, + net_simplify_server.SendMessage(state, customer, UserServer.ServerSettings.Can_Account_Login ? "1" : "0" + UserServer.ServerSettings.Account_Forbidden_Reason); } @@ -486,7 +486,8 @@ namespace 软件系统服务端模版 { JObject json = new JObject { - { nameof(UserServer.ServerSettings.Announcement), new JValue(UserServer.ServerSettings.Announcement) } + { nameof(UserServer.ServerSettings.Announcement), new JValue(UserServer.ServerSettings.Announcement) }, + { nameof(UserServer.ServerSettings.SystemFactories), new JArray(UserServer.ServerSettings.SystemFactories) }, }; net_simplify_server.SendMessage(state, customer, json.ToString()); } @@ -501,9 +502,9 @@ namespace 软件系统服务端模版 UserAccount account = UserServer.ServerAccounts.CheckAccount(name, password, state.GetRemoteEndPoint().Address.ToString(), way); //检测是否重复登录 - if(account.LoginEnable) + if (account.LoginEnable) { - if(IsClinetOnline(account.UserName)) + if (IsClinetOnline(account.UserName)) { account.LoginEnable = false; account.ForbidMessage = "该账户已经登录"; @@ -576,7 +577,7 @@ namespace 软件系统服务端模版 } else if (customer == CommonHeadCode.SimplifyHeadCode.异常消息) { - ClientsLogHelper.WriteError(data); + ClientsLogHelper.WriteFatal(data); net_simplify_server.SendMessage(state, customer, "成功"); //发送到邮箱 SendUserMail("异常记录", "时间:" + DateTime.Now.ToString("O") + Environment.NewLine + data); @@ -584,7 +585,7 @@ namespace 软件系统服务端模版 else if (customer == CommonHeadCode.SimplifyHeadCode.请求小头) { string fileName = Application.StartupPath + @"\Files\Portrait\" + data + @"\" + PortraitSupport.SmallPortrait; - if(string.IsNullOrEmpty(fileName)) + if (string.IsNullOrEmpty(fileName)) { net_simplify_server.SendMessage(state, customer, "N"); } @@ -594,7 +595,7 @@ namespace 软件系统服务端模版 { net_simplify_server.SendMessage(state, customer, "Y" + SoftBasic.CalculateFileMD5(fileName)); } - catch(Exception ex) + catch (Exception ex) { net_simplify_server.SendMessage(state, customer, "N"); RuntimeLogHelper.WriteException(null, ex); @@ -625,6 +626,18 @@ namespace 软件系统服务端模版 net_simplify_server.SendMessage(state, customer, "Y" + Convert.ToBase64String(System.IO.File.ReadAllBytes(fileName))); } } + else if (customer == CommonHeadCode.SimplifyHeadCode.上传分厂) + { + try + { + UserServer.ServerSettings.SystemFactories = JArray.Parse(data).ToObject>(); + } + catch (Exception ex) + { + RuntimeLogHelper?.WriteException(null, ex); + } + net_simplify_server.SendMessage(state, customer, "1"); + } else { net_simplify_server.SendMessage(state, customer, data);