Browse Source

配置修改

WIN-GH9CEESPLTB\Administrator 1 month ago
parent
commit
acc9548dfc

+ 1 - 1
MainForm/ClassFile/ProjectClass/GlobalContext.cs

@@ -489,7 +489,7 @@ namespace MainForm
                 // 本地数据库
                 Server = IniFile.INIGetStringValue(FilePath, "LocalDB", "Server", @"localhost");
                 User = IniFile.INIGetStringValue(FilePath, "LocalDB", "User", "sa");
-                PassWord = IniFile.INIGetStringValue(FilePath, "LocalDB", "PassWord", "Aa123456");
+                PassWord = IniFile.INIGetStringValue(FilePath, "LocalDB", "PassWord", "bozhong123");
 
                 MacStr = IPHelper.GetMoAddress();
 

+ 91 - 3
MainForm/FaForm/Form_Home.cs

@@ -189,7 +189,7 @@ namespace MainForm
         /// <summary>
         /// 窗体加载事件
         /// </summary>
-        private void Form_Home_Load(object sender, EventArgs e)
+        public void Form_Home_Load(object sender, EventArgs e)
         {
             try
             {
@@ -388,7 +388,7 @@ namespace MainForm
                             if (GlobalContext.IsUsePLC3)
                             {
                                 param.parameter.equipment.deviceCode = GlobalContext.s3_1_device_code; // 装备编码
-                                //param.parameter.equipment.stationCode = GlobalContext.s3_1_station;     // ⼯位Id
+                                                                                                       //param.parameter.equipment.stationCode = GlobalContext.s3_1_station;     // ⼯位Id
                             }
 
                             if (GlobalContext.IsUsePLC4)
@@ -415,7 +415,7 @@ namespace MainForm
                             if (GlobalContext.IsUsePLC7)
                             {
                                 param.parameter.equipment.deviceCode = GlobalContext.s7_1_device_code; // 装备编码
-                                //param.parameter.equipment.stationCode = GlobalContext.s7_1_station;     // ⼯位Id
+                                                                                                       //param.parameter.equipment.stationCode = GlobalContext.s7_1_station;     // ⼯位Id
                                 xiaomiParm.stationCode = GlobalContext.s7_1_station;
                             }
 
@@ -1383,6 +1383,94 @@ namespace MainForm
         private bool OpenDailogFalg = true; //是否开启扫码弹窗标识
         public static bool isNoStop = false; //是否停止循环
 
+        public void ConnectToIOT()
+        {
+            XiaomiMqttLoginFunAndParam param = new XiaomiMqttLoginFunAndParam();
+            // fds
+            param.parameter.fds.address = GlobalContext.address;
+            param.parameter.fds.appId = GlobalContext.appId;
+            param.parameter.fds.appKey = GlobalContext.appKey;
+            // mes
+            param.parameter.mes.address = GlobalContext.ServerIp;
+            param.parameter.mes.appId = GlobalContext.MESAppId;
+            param.parameter.mes.appKey = GlobalContext.MESAppKey;
+            // mqtt
+            param.parameter.mqtt.address = GlobalContext.MQTTServerHost;
+            param.parameter.mqtt.port = GlobalContext.MQTTServerPort;
+            param.parameter.mqtt.username = GlobalContext.MQTTAppId;
+            param.parameter.mqtt.password = GlobalContext.MQTTAppPwd;
+            // 设备配置
+            param.parameter.equipment.factoryCode = GlobalContext.Factory_Code;
+            if (GlobalContext.IsUsePLC1)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.S1_device_code; // 装备编码
+                param.parameter.equipment.stationCode = GlobalContext.S1_station; // ⼯位Id
+                xiaomiParm.workstation = GlobalContext.S1_work_station; //工站
+            }
+
+            if (GlobalContext.IsUsePLC2)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.S2_device_code; // 装备编码
+                param.parameter.equipment.stationCode = GlobalContext.S2_station; // ⼯位Id
+                xiaomiParm.workstation = GlobalContext.S2_work_station; //工站
+            }
+
+            if (GlobalContext.IsUsePLC3)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.s3_1_device_code; // 装备编码
+                                                                                       //param.parameter.equipment.stationCode = GlobalContext.s3_1_station;     // ⼯位Id
+            }
+
+            if (GlobalContext.IsUsePLC4)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.s4_device_code; // 装备编码
+                param.parameter.equipment.stationCode = GlobalContext.s4_station; // ⼯位Id
+                xiaomiParm.workstation = GlobalContext.s4_work_station; //工站
+            }
+
+            if (GlobalContext.IsUsePLC5)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.s5_device_code; // 装备编码
+                param.parameter.equipment.stationCode = GlobalContext.s5_station; // ⼯位Id
+                xiaomiParm.workstation = GlobalContext.s5_work_station; //工站
+            }
+
+            if (GlobalContext.IsUsePLC6)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.s6_device_code; // 装备编码
+                param.parameter.equipment.stationCode = GlobalContext.s6_station; // ⼯位Id
+                xiaomiParm.workstation = GlobalContext.s6_work_station; //工站
+            }
+
+            if (GlobalContext.IsUsePLC7)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.s7_1_device_code; // 装备编码
+                                                                                       //param.parameter.equipment.stationCode = GlobalContext.s7_1_station;     // ⼯位Id
+                xiaomiParm.stationCode = GlobalContext.s7_1_station;
+            }
+
+            if (GlobalContext.IsUsePLC8)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.s8_device_code; // 装备编码
+                param.parameter.equipment.stationCode = GlobalContext.s8_station; // ⼯位Id
+                xiaomiParm.workstation = GlobalContext.s8_work_station; //工站
+            }
+
+            if (GlobalContext.IsUsePLC9)
+            {
+                param.parameter.equipment.deviceCode = GlobalContext.s9_device_code; // 装备编码
+                param.parameter.equipment.stationCode = GlobalContext.s9_station; // ⼯位Id
+                xiaomiParm.workstation = GlobalContext.s9_work_station; //工站
+            }
+
+            param.parameter.equipment.project = GlobalContext.Project_Code;
+            param.parameter.equipment.productMode = "debug";
+
+            param.parameter.other.logLevel = 0;
+            param.parameter.other.LogPath = GlobalContext.MqttLogDir;
+
+            XiaomiMqttClient_Extend.ParameterConfig(param);
+        }
 
         /// <summary>
         /// float[]转为string

+ 100 - 154
MainForm/FaForm/Form_SystemSet.Designer.cs

@@ -53,7 +53,6 @@
             this.textBoxServerHost = new System.Windows.Forms.TextBox();
             this.cbSendProcessData = new System.Windows.Forms.CheckBox();
             this.button1 = new System.Windows.Forms.Button();
-            this.btnMES = new System.Windows.Forms.Button();
             this.cbSendStationIn = new System.Windows.Forms.CheckBox();
             this.chkIsUseMes = new System.Windows.Forms.CheckBox();
             this.groupBox2 = new System.Windows.Forms.GroupBox();
@@ -61,7 +60,6 @@
             this.txtMqttIP = new System.Windows.Forms.TextBox();
             this.chkMqttPassStation = new System.Windows.Forms.CheckBox();
             this.button5 = new System.Windows.Forms.Button();
-            this.btnIOTData = new System.Windows.Forms.Button();
             this.chkMqttDeviceState = new System.Windows.Forms.CheckBox();
             this.chkMqttEquiConfig = new System.Windows.Forms.CheckBox();
             this.chkMqttFaultLog = new System.Windows.Forms.CheckBox();
@@ -73,6 +71,8 @@
             this.numMqttPort = new System.Windows.Forms.NumericUpDown();
             this.chkIsUseIot = new System.Windows.Forms.CheckBox();
             this.groupBox4 = new System.Windows.Forms.GroupBox();
+            this.chkMqttPassResult = new System.Windows.Forms.CheckBox();
+            this.chkMqttUpFile = new System.Windows.Forms.CheckBox();
             this.label12 = new System.Windows.Forms.Label();
             this.txtAGVHttpIP = new System.Windows.Forms.TextBox();
             this.button6 = new System.Windows.Forms.Button();
@@ -90,7 +90,6 @@
             this.txtPLCAddress3 = new System.Windows.Forms.TextBox();
             this.txtPLCAddress5 = new System.Windows.Forms.TextBox();
             this.txtPLCAddress4 = new System.Windows.Forms.TextBox();
-            this.btnPLC = new System.Windows.Forms.Button();
             this.rdbS1 = new System.Windows.Forms.RadioButton();
             this.rdbS2 = new System.Windows.Forms.RadioButton();
             this.rdbS4 = new System.Windows.Forms.RadioButton();
@@ -99,16 +98,14 @@
             this.label11 = new System.Windows.Forms.Label();
             this.numPLCPort = new System.Windows.Forms.NumericUpDown();
             this.groupBox3 = new System.Windows.Forms.GroupBox();
-            this.rdbS6 = new System.Windows.Forms.RadioButton();
-            this.txtPLCAddress6 = new System.Windows.Forms.TextBox();
-            this.rdbS7 = new System.Windows.Forms.RadioButton();
-            this.txtPLCAddress7 = new System.Windows.Forms.TextBox();
-            this.rdbS8 = new System.Windows.Forms.RadioButton();
-            this.txtPLCAddress8 = new System.Windows.Forms.TextBox();
             this.rdbS9 = new System.Windows.Forms.RadioButton();
             this.txtPLCAddress9 = new System.Windows.Forms.TextBox();
-            this.chkMqttUpFile = new System.Windows.Forms.CheckBox();
-            this.chkMqttPassResult = new System.Windows.Forms.CheckBox();
+            this.rdbS8 = new System.Windows.Forms.RadioButton();
+            this.txtPLCAddress8 = new System.Windows.Forms.TextBox();
+            this.rdbS7 = new System.Windows.Forms.RadioButton();
+            this.txtPLCAddress7 = new System.Windows.Forms.TextBox();
+            this.rdbS6 = new System.Windows.Forms.RadioButton();
+            this.txtPLCAddress6 = new System.Windows.Forms.TextBox();
             this.groupBox1.SuspendLayout();
             this.groupBox2.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.numMqttPort)).BeginInit();
@@ -151,7 +148,7 @@
             this.textBoxLineName.Location = new System.Drawing.Point(664, 81);
             this.textBoxLineName.Margin = new System.Windows.Forms.Padding(4);
             this.textBoxLineName.Name = "textBoxLineName";
-            this.textBoxLineName.Size = new System.Drawing.Size(842, 36);
+            this.textBoxLineName.Size = new System.Drawing.Size(740, 36);
             this.textBoxLineName.TabIndex = 74;
             // 
             // label7
@@ -197,9 +194,9 @@
             this.buttonConfirm.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
             this.buttonConfirm.BackColor = System.Drawing.Color.WhiteSmoke;
             this.buttonConfirm.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.buttonConfirm.Location = new System.Drawing.Point(1458, 175);
+            this.buttonConfirm.Location = new System.Drawing.Point(1446, 24);
             this.buttonConfirm.Name = "buttonConfirm";
-            this.buttonConfirm.Size = new System.Drawing.Size(84, 45);
+            this.buttonConfirm.Size = new System.Drawing.Size(108, 45);
             this.buttonConfirm.TabIndex = 66;
             this.buttonConfirm.Text = "保存";
             this.buttonConfirm.UseVisualStyleBackColor = false;
@@ -243,7 +240,7 @@
             // 
             // txtProcess_Section_Code
             // 
-            this.txtProcess_Section_Code.Location = new System.Drawing.Point(1253, 26);
+            this.txtProcess_Section_Code.Location = new System.Drawing.Point(1154, 26);
             this.txtProcess_Section_Code.Margin = new System.Windows.Forms.Padding(4);
             this.txtProcess_Section_Code.Name = "txtProcess_Section_Code";
             this.txtProcess_Section_Code.Size = new System.Drawing.Size(250, 36);
@@ -252,7 +249,7 @@
             // label5
             // 
             this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(1124, 30);
+            this.label5.Location = new System.Drawing.Point(1025, 30);
             this.label5.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label5.Name = "label5";
             this.label5.Size = new System.Drawing.Size(106, 30);
@@ -261,7 +258,7 @@
             // 
             // txtWorkStation
             // 
-            this.txtWorkStation.Location = new System.Drawing.Point(1256, 132);
+            this.txtWorkStation.Location = new System.Drawing.Point(1157, 132);
             this.txtWorkStation.Margin = new System.Windows.Forms.Padding(4);
             this.txtWorkStation.Name = "txtWorkStation";
             this.txtWorkStation.Size = new System.Drawing.Size(250, 36);
@@ -270,7 +267,7 @@
             // label9
             // 
             this.label9.AutoSize = true;
-            this.label9.Location = new System.Drawing.Point(1126, 136);
+            this.label9.Location = new System.Drawing.Point(1027, 136);
             this.label9.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(62, 30);
@@ -385,19 +382,6 @@
             this.button1.Text = "确认";
             this.button1.UseVisualStyleBackColor = true;
             // 
-            // btnMES
-            // 
-            this.btnMES.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnMES.BackColor = System.Drawing.Color.WhiteSmoke;
-            this.btnMES.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btnMES.Location = new System.Drawing.Point(1460, 60);
-            this.btnMES.Name = "btnMES";
-            this.btnMES.Size = new System.Drawing.Size(84, 40);
-            this.btnMES.TabIndex = 70;
-            this.btnMES.Text = "保存";
-            this.btnMES.UseVisualStyleBackColor = false;
-            this.btnMES.Click += new System.EventHandler(this.button2_Click);
-            // 
             // cbSendStationIn
             // 
             this.cbSendStationIn.AutoSize = true;
@@ -425,7 +409,6 @@
             this.groupBox2.BackColor = System.Drawing.Color.White;
             this.groupBox2.Controls.Add(this.chkIsUseMes);
             this.groupBox2.Controls.Add(this.cbSendStationIn);
-            this.groupBox2.Controls.Add(this.btnMES);
             this.groupBox2.Controls.Add(this.button1);
             this.groupBox2.Controls.Add(this.cbSendProcessData);
             this.groupBox2.Controls.Add(this.textBoxServerHost);
@@ -479,19 +462,6 @@
             this.button5.Text = "确认";
             this.button5.UseVisualStyleBackColor = true;
             // 
-            // btnIOTData
-            // 
-            this.btnIOTData.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnIOTData.BackColor = System.Drawing.Color.WhiteSmoke;
-            this.btnIOTData.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btnIOTData.Location = new System.Drawing.Point(1460, 69);
-            this.btnIOTData.Name = "btnIOTData";
-            this.btnIOTData.Size = new System.Drawing.Size(84, 40);
-            this.btnIOTData.TabIndex = 70;
-            this.btnIOTData.Text = "保存";
-            this.btnIOTData.UseVisualStyleBackColor = false;
-            this.btnIOTData.Click += new System.EventHandler(this.btnIOTData_Click);
-            // 
             // chkMqttDeviceState
             // 
             this.chkMqttDeviceState.AutoSize = true;
@@ -613,7 +583,6 @@
             this.groupBox4.Controls.Add(this.chkMqttFaultLog);
             this.groupBox4.Controls.Add(this.chkMqttEquiConfig);
             this.groupBox4.Controls.Add(this.chkMqttDeviceState);
-            this.groupBox4.Controls.Add(this.btnIOTData);
             this.groupBox4.Controls.Add(this.button5);
             this.groupBox4.Controls.Add(this.chkMqttPassStation);
             this.groupBox4.Controls.Add(this.txtMqttIP);
@@ -629,6 +598,28 @@
             this.groupBox4.TabStop = false;
             this.groupBox4.Text = "IOT配置";
             // 
+            // chkMqttPassResult
+            // 
+            this.chkMqttPassResult.AutoSize = true;
+            this.chkMqttPassResult.Location = new System.Drawing.Point(211, 88);
+            this.chkMqttPassResult.Margin = new System.Windows.Forms.Padding(4);
+            this.chkMqttPassResult.Name = "chkMqttPassResult";
+            this.chkMqttPassResult.Size = new System.Drawing.Size(171, 34);
+            this.chkMqttPassResult.TabIndex = 87;
+            this.chkMqttPassResult.Text = "上传过站结果";
+            this.chkMqttPassResult.UseVisualStyleBackColor = true;
+            // 
+            // chkMqttUpFile
+            // 
+            this.chkMqttUpFile.AutoSize = true;
+            this.chkMqttUpFile.Location = new System.Drawing.Point(1173, 88);
+            this.chkMqttUpFile.Margin = new System.Windows.Forms.Padding(4);
+            this.chkMqttUpFile.Name = "chkMqttUpFile";
+            this.chkMqttUpFile.Size = new System.Drawing.Size(171, 34);
+            this.chkMqttUpFile.TabIndex = 86;
+            this.chkMqttUpFile.Text = "上传非结构化";
+            this.chkMqttUpFile.UseVisualStyleBackColor = true;
+            // 
             // label12
             // 
             this.label12.AutoSize = true;
@@ -658,16 +649,10 @@
             // 
             // btnAGV
             // 
-            this.btnAGV.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnAGV.BackColor = System.Drawing.Color.WhiteSmoke;
-            this.btnAGV.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btnAGV.Location = new System.Drawing.Point(1460, 33);
+            this.btnAGV.Location = new System.Drawing.Point(0, 0);
             this.btnAGV.Name = "btnAGV";
-            this.btnAGV.Size = new System.Drawing.Size(84, 40);
-            this.btnAGV.TabIndex = 70;
-            this.btnAGV.Text = "保存";
-            this.btnAGV.UseVisualStyleBackColor = false;
-            this.btnAGV.Click += new System.EventHandler(this.btnAGV_Click);
+            this.btnAGV.Size = new System.Drawing.Size(75, 23);
+            this.btnAGV.TabIndex = 89;
             // 
             // chkIsUseAGV
             // 
@@ -794,19 +779,6 @@
             this.txtPLCAddress4.Size = new System.Drawing.Size(250, 36);
             this.txtPLCAddress4.TabIndex = 82;
             // 
-            // btnPLC
-            // 
-            this.btnPLC.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
-            this.btnPLC.BackColor = System.Drawing.Color.WhiteSmoke;
-            this.btnPLC.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.btnPLC.Location = new System.Drawing.Point(1460, 155);
-            this.btnPLC.Name = "btnPLC";
-            this.btnPLC.Size = new System.Drawing.Size(84, 42);
-            this.btnPLC.TabIndex = 87;
-            this.btnPLC.Text = "保存";
-            this.btnPLC.UseVisualStyleBackColor = false;
-            this.btnPLC.Click += new System.EventHandler(this.button3_Click);
-            // 
             // rdbS1
             // 
             this.rdbS1.AutoSize = true;
@@ -932,7 +904,6 @@
             this.groupBox3.Controls.Add(this.rdbS4);
             this.groupBox3.Controls.Add(this.rdbS2);
             this.groupBox3.Controls.Add(this.rdbS1);
-            this.groupBox3.Controls.Add(this.btnPLC);
             this.groupBox3.Controls.Add(this.txtPLCAddress4);
             this.groupBox3.Controls.Add(this.txtPLCAddress5);
             this.groupBox3.Controls.Add(this.txtPLCAddress3);
@@ -949,53 +920,29 @@
             this.groupBox3.TabStop = false;
             this.groupBox3.Text = "设备配置";
             // 
-            // rdbS6
-            // 
-            this.rdbS6.AutoSize = true;
-            this.rdbS6.BackColor = System.Drawing.Color.Transparent;
-            this.rdbS6.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.rdbS6.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.rdbS6.ForeColor = System.Drawing.Color.Black;
-            this.rdbS6.Location = new System.Drawing.Point(1062, 73);
-            this.rdbS6.Margin = new System.Windows.Forms.Padding(4);
-            this.rdbS6.Name = "rdbS6";
-            this.rdbS6.Size = new System.Drawing.Size(182, 35);
-            this.rdbS6.TabIndex = 97;
-            this.rdbS6.TabStop = true;
-            this.rdbS6.Text = "[S6]组上盖板:";
-            this.rdbS6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            this.rdbS6.UseVisualStyleBackColor = false;
-            // 
-            // txtPLCAddress6
-            // 
-            this.txtPLCAddress6.Location = new System.Drawing.Point(1294, 71);
-            this.txtPLCAddress6.Name = "txtPLCAddress6";
-            this.txtPLCAddress6.Size = new System.Drawing.Size(250, 36);
-            this.txtPLCAddress6.TabIndex = 96;
-            // 
-            // rdbS7
+            // rdbS9
             // 
-            this.rdbS7.AutoSize = true;
-            this.rdbS7.BackColor = System.Drawing.Color.Transparent;
-            this.rdbS7.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.rdbS7.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.rdbS7.ForeColor = System.Drawing.Color.Black;
-            this.rdbS7.Location = new System.Drawing.Point(13, 119);
-            this.rdbS7.Margin = new System.Windows.Forms.Padding(4);
-            this.rdbS7.Name = "rdbS7";
-            this.rdbS7.Size = new System.Drawing.Size(226, 35);
-            this.rdbS7.TabIndex = 99;
-            this.rdbS7.TabStop = true;
-            this.rdbS7.Text = "[S7]上盖板锁螺丝:";
-            this.rdbS7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            this.rdbS7.UseVisualStyleBackColor = false;
+            this.rdbS9.AutoSize = true;
+            this.rdbS9.BackColor = System.Drawing.Color.Transparent;
+            this.rdbS9.FlatStyle = System.Windows.Forms.FlatStyle.System;
+            this.rdbS9.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.rdbS9.ForeColor = System.Drawing.Color.Black;
+            this.rdbS9.Location = new System.Drawing.Point(1062, 113);
+            this.rdbS9.Margin = new System.Windows.Forms.Padding(4);
+            this.rdbS9.Name = "rdbS9";
+            this.rdbS9.Size = new System.Drawing.Size(204, 35);
+            this.rdbS9.TabIndex = 103;
+            this.rdbS9.TabStop = true;
+            this.rdbS9.Text = "[S9]半成品下料:";
+            this.rdbS9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.rdbS9.UseVisualStyleBackColor = false;
             // 
-            // txtPLCAddress7
+            // txtPLCAddress9
             // 
-            this.txtPLCAddress7.Location = new System.Drawing.Point(245, 119);
-            this.txtPLCAddress7.Name = "txtPLCAddress7";
-            this.txtPLCAddress7.Size = new System.Drawing.Size(250, 36);
-            this.txtPLCAddress7.TabIndex = 98;
+            this.txtPLCAddress9.Location = new System.Drawing.Point(1294, 113);
+            this.txtPLCAddress9.Name = "txtPLCAddress9";
+            this.txtPLCAddress9.Size = new System.Drawing.Size(250, 36);
+            this.txtPLCAddress9.TabIndex = 102;
             // 
             // rdbS8
             // 
@@ -1021,51 +968,53 @@
             this.txtPLCAddress8.Size = new System.Drawing.Size(250, 36);
             this.txtPLCAddress8.TabIndex = 100;
             // 
-            // rdbS9
+            // rdbS7
             // 
-            this.rdbS9.AutoSize = true;
-            this.rdbS9.BackColor = System.Drawing.Color.Transparent;
-            this.rdbS9.FlatStyle = System.Windows.Forms.FlatStyle.System;
-            this.rdbS9.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.rdbS9.ForeColor = System.Drawing.Color.Black;
-            this.rdbS9.Location = new System.Drawing.Point(1062, 113);
-            this.rdbS9.Margin = new System.Windows.Forms.Padding(4);
-            this.rdbS9.Name = "rdbS9";
-            this.rdbS9.Size = new System.Drawing.Size(204, 35);
-            this.rdbS9.TabIndex = 103;
-            this.rdbS9.TabStop = true;
-            this.rdbS9.Text = "[S9]半成品下料:";
-            this.rdbS9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
-            this.rdbS9.UseVisualStyleBackColor = false;
+            this.rdbS7.AutoSize = true;
+            this.rdbS7.BackColor = System.Drawing.Color.Transparent;
+            this.rdbS7.FlatStyle = System.Windows.Forms.FlatStyle.System;
+            this.rdbS7.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.rdbS7.ForeColor = System.Drawing.Color.Black;
+            this.rdbS7.Location = new System.Drawing.Point(13, 119);
+            this.rdbS7.Margin = new System.Windows.Forms.Padding(4);
+            this.rdbS7.Name = "rdbS7";
+            this.rdbS7.Size = new System.Drawing.Size(226, 35);
+            this.rdbS7.TabIndex = 99;
+            this.rdbS7.TabStop = true;
+            this.rdbS7.Text = "[S7]上盖板锁螺丝:";
+            this.rdbS7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.rdbS7.UseVisualStyleBackColor = false;
             // 
-            // txtPLCAddress9
+            // txtPLCAddress7
             // 
-            this.txtPLCAddress9.Location = new System.Drawing.Point(1294, 113);
-            this.txtPLCAddress9.Name = "txtPLCAddress9";
-            this.txtPLCAddress9.Size = new System.Drawing.Size(250, 36);
-            this.txtPLCAddress9.TabIndex = 102;
+            this.txtPLCAddress7.Location = new System.Drawing.Point(245, 119);
+            this.txtPLCAddress7.Name = "txtPLCAddress7";
+            this.txtPLCAddress7.Size = new System.Drawing.Size(250, 36);
+            this.txtPLCAddress7.TabIndex = 98;
             // 
-            // chkMqttUpFile
+            // rdbS6
             // 
-            this.chkMqttUpFile.AutoSize = true;
-            this.chkMqttUpFile.Location = new System.Drawing.Point(1173, 88);
-            this.chkMqttUpFile.Margin = new System.Windows.Forms.Padding(4);
-            this.chkMqttUpFile.Name = "chkMqttUpFile";
-            this.chkMqttUpFile.Size = new System.Drawing.Size(171, 34);
-            this.chkMqttUpFile.TabIndex = 86;
-            this.chkMqttUpFile.Text = "上传非结构化";
-            this.chkMqttUpFile.UseVisualStyleBackColor = true;
+            this.rdbS6.AutoSize = true;
+            this.rdbS6.BackColor = System.Drawing.Color.Transparent;
+            this.rdbS6.FlatStyle = System.Windows.Forms.FlatStyle.System;
+            this.rdbS6.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.rdbS6.ForeColor = System.Drawing.Color.Black;
+            this.rdbS6.Location = new System.Drawing.Point(1062, 73);
+            this.rdbS6.Margin = new System.Windows.Forms.Padding(4);
+            this.rdbS6.Name = "rdbS6";
+            this.rdbS6.Size = new System.Drawing.Size(182, 35);
+            this.rdbS6.TabIndex = 97;
+            this.rdbS6.TabStop = true;
+            this.rdbS6.Text = "[S6]组上盖板:";
+            this.rdbS6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+            this.rdbS6.UseVisualStyleBackColor = false;
             // 
-            // chkMqttPassResult
+            // txtPLCAddress6
             // 
-            this.chkMqttPassResult.AutoSize = true;
-            this.chkMqttPassResult.Location = new System.Drawing.Point(211, 88);
-            this.chkMqttPassResult.Margin = new System.Windows.Forms.Padding(4);
-            this.chkMqttPassResult.Name = "chkMqttPassResult";
-            this.chkMqttPassResult.Size = new System.Drawing.Size(171, 34);
-            this.chkMqttPassResult.TabIndex = 87;
-            this.chkMqttPassResult.Text = "上传过站结果";
-            this.chkMqttPassResult.UseVisualStyleBackColor = true;
+            this.txtPLCAddress6.Location = new System.Drawing.Point(1294, 71);
+            this.txtPLCAddress6.Name = "txtPLCAddress6";
+            this.txtPLCAddress6.Size = new System.Drawing.Size(250, 36);
+            this.txtPLCAddress6.TabIndex = 96;
             // 
             // Form_SystemSet
             // 
@@ -1128,7 +1077,6 @@
         private System.Windows.Forms.TextBox textBoxServerHost;
         private System.Windows.Forms.CheckBox cbSendProcessData;
         private System.Windows.Forms.Button button1;
-        private System.Windows.Forms.Button btnMES;
         private System.Windows.Forms.CheckBox cbSendStationIn;
         private System.Windows.Forms.CheckBox chkIsUseMes;
         private System.Windows.Forms.GroupBox groupBox2;
@@ -1136,7 +1084,6 @@
         private System.Windows.Forms.TextBox txtMqttIP;
         private System.Windows.Forms.CheckBox chkMqttPassStation;
         private System.Windows.Forms.Button button5;
-        private System.Windows.Forms.Button btnIOTData;
         private System.Windows.Forms.CheckBox chkMqttDeviceState;
         private System.Windows.Forms.CheckBox chkMqttEquiConfig;
         private System.Windows.Forms.CheckBox chkMqttFaultLog;
@@ -1165,7 +1112,6 @@
         private System.Windows.Forms.TextBox txtPLCAddress3;
         private System.Windows.Forms.TextBox txtPLCAddress5;
         private System.Windows.Forms.TextBox txtPLCAddress4;
-        private System.Windows.Forms.Button btnPLC;
         private System.Windows.Forms.RadioButton rdbS1;
         private System.Windows.Forms.RadioButton rdbS2;
         private System.Windows.Forms.RadioButton rdbS4;

+ 26 - 33
MainForm/FaForm/Form_SystemSet.cs

@@ -159,6 +159,7 @@ namespace MainForm
         /// </summary>
         private void buttonConfirm_Click(object sender, EventArgs e)
         {
+            #region 产线信息
             try
             {
                 IniFile.INIWriteValue(FilePath, "Product", "ProjectCode", txtProject_code.Text.Trim());
@@ -223,7 +224,6 @@ namespace MainForm
                     IniFile.INIWriteValue(FilePath, "Station", "s9_device_code", txtDeviceCode.Text.Trim());
                     IniFile.INIWriteValue(FilePath, "Station", "s9_station", txtStation.Text.Trim());
                 }
-                MessageBox.Show("参数保存成功!");
                 GlobalContext.UpdateData();
 
                 //记录修改日志
@@ -245,23 +245,17 @@ namespace MainForm
                 string str = ex.StackTrace;
                 OnMessage(LogType.Info, "保存产线信息出错!异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1) + ";异常信息:" + ex.Message.ToString());
             }
-        }
+            #endregion
 
-        /// <summary>
-        /// 保存MES配置
-        /// </summary>
-        private void button2_Click(object sender, EventArgs e)
-        {
+            #region MES
             try
             {
                 // 是否 启用MES
                 IniFile.INIWriteValue(FilePath, "MES", "IsUseMES", chkIsUseMes.Checked.ToString());
-
                 IniFile.INIWriteValue(FilePath, "MES", "ServerHost", textBoxServerHost.Text.Trim().ToString());
                 IniFile.INIWriteValue(FilePath, "MES", "IsSendStationIn", cbSendStationIn.Checked.ToString());
                 IniFile.INIWriteValue(FilePath, "MES", "IsSendProcessData", cbSendProcessData.Checked.ToString());
 
-                MessageBox.Show("参数保存成功!");
                 GlobalContext.UpdateData();
 
                 //记录修改日志
@@ -279,13 +273,9 @@ namespace MainForm
                 string str = ex.StackTrace;
                 OnMessage(LogType.Info, "保存MES配置出错!异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1) + ";异常信息:" + ex.Message.ToString());
             }
-        }
+            #endregion
 
-        /// <summary>
-        /// 保存IOT配置
-        /// </summary>
-        private void btnIOTData_Click(object sender, EventArgs e)
-        {
+            #region IOT
             try
             {
                 IniFile.INIWriteValue(FilePath, "MQTT", "IsUseIot", chkIsUseIot.Checked.ToString());
@@ -302,7 +292,6 @@ namespace MainForm
                 IniFile.INIWriteValue(FilePath, "MQTT", "IsMqttSendProcessResult", chkMqttPassResult.Checked.ToString());  // 上传过站结果
                 IniFile.INIWriteValue(FilePath, "MQTT", "MQTTIsSendUpFile", chkMqttUpFile.Checked.ToString());  // 上传非结构化
 
-                MessageBox.Show("参数保存成功!");
                 GlobalContext.UpdateData();
 
                 //记录修改日志
@@ -326,13 +315,9 @@ namespace MainForm
                 string str = ex.StackTrace;
                 OnMessage(LogType.Info, "保存IOT配置出错!异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1) + ";异常信息:" + ex.Message.ToString());
             }
-        }
+            #endregion
 
-        /// <summary>
-        /// 保存AGV配置
-        /// </summary>
-        private void btnAGV_Click(object sender, EventArgs e)
-        {
+            #region AGV
             try
             {
                 IniFile.INIWriteValue(FilePath, "AGV", "IsUseAGV", chkIsUseAGV.Checked.ToString());  // 是否 启用AGV
@@ -340,8 +325,7 @@ namespace MainForm
                 IniFile.INIWriteValue(FilePath, "AGV", "AGVMQTTHost", IPAddress.Parse(txtAGVMQTTIP.Text.Trim()).ToString());  // MQTT IP地址
                 IniFile.INIWriteValue(FilePath, "AGV", "AGVMQTTPort", numAGVMQTTPort.Value.ToString());                       // MQTT端口
                 IniFile.INIWriteValue(FilePath, "AGV", "AGVMQTTDeviceCode", txtTPortCode.Text.ToString());                    // MQTT PortCode
-                
-                MessageBox.Show("参数保存成功!");
+
                 GlobalContext.UpdateData();
 
                 //记录修改日志
@@ -360,13 +344,9 @@ namespace MainForm
                 string str = ex.StackTrace;
                 OnMessage(LogType.Error, "保存AGV配置出错!异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1) + ";异常信息:" + ex.Message.ToString());
             }
-        }
+            #endregion
 
-        /// <summary>
-        /// 保存设备配置
-        /// </summary>
-        private void button3_Click(object sender, EventArgs e)
-        {
+            #region 装备设置
             try
             {
                 IniFile.INIWriteValue(FilePath, "Machine", "IsUsePLC1", rdbS1.Checked.ToString());
@@ -389,8 +369,7 @@ namespace MainForm
                 IniFile.INIWriteValue(FilePath, "Machine", "Machine8Address", IPAddress.Parse(txtPLCAddress8.Text.Trim()).ToString());
                 IniFile.INIWriteValue(FilePath, "Machine", "Machine9Address", IPAddress.Parse(txtPLCAddress9.Text.Trim()).ToString());
 
-                IniFile.INIWriteValue(FilePath, "Machine", "MachinePort",numPLCPort.Value.ToString());
-                MessageBox.Show("参数保存成功!");
+                IniFile.INIWriteValue(FilePath, "Machine", "MachinePort", numPLCPort.Value.ToString());
                 GlobalContext.UpdateData();
 
                 //记录修改日志
@@ -424,8 +403,22 @@ namespace MainForm
                 string str = ex.StackTrace;
                 OnMessage(LogType.Error, "保存设备配置出错!异常位置:" + str.Substring(str.LastIndexOf("\\") + 1, str.Length - str.LastIndexOf("\\") - 1) + ";异常信息:" + ex.Message.ToString());
             }
-        }
+            #endregion
 
+            try
+            {
+                MessageBox.Show("参数保存成功!");
+                Form_Home home = new Form_Home();
+                home.ConnectToIOT();
+                GlobalContext.UpdateData();
+            }
+            catch (Exception)
+            {
+
+                throw;
+            }
+
+        }
 
         /// <summary>
         /// 获取订单信息