Przeglądaj źródła

TCP服务调整

章政 8 lat temu
rodzic
commit
6165f8678d

+ 108 - 50
UAS-MES/FunctionCode/Make/Make_CartonBoxSNWeigh.Designer.cs

@@ -52,11 +52,6 @@
             this.Printer_label = new System.Windows.Forms.Label();
             this.label1 = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
-            this.WeighRecord = new System.Windows.Forms.ListView();
-            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.columnHeader2 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.columnHeader3 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.columnHeader4 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.pr_sendchecktype = new System.Windows.Forms.Label();
             this.RefreshWeigh = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             this.PrintNum = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
@@ -79,6 +74,12 @@
             this.OperateResult = new UAS_MES.CustomControl.RichText.RichTextAutoBottom();
             this.fileSystemWatcher1 = new System.IO.FileSystemWatcher();
             this.StepCount = new UAS_MES.CustomControl.TextBoxWithIcon.SourceStepCount();
+            this.CloseServer = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.BuildServer = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.Port = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.Port_label = new System.Windows.Forms.Label();
+            this.IP = new UAS_MES.CustomControl.TextBoxWithIcon.SnCollectionBox();
+            this.IP_label = new System.Windows.Forms.Label();
             this.panel6.SuspendLayout();
             this.panel4.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).BeginInit();
@@ -337,42 +338,6 @@
             this.label2.TabIndex = 171;
             this.label2.Text = "打印张数";
             // 
-            // WeighRecord
-            // 
-            this.WeighRecord.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.columnHeader1,
-            this.columnHeader2,
-            this.columnHeader3,
-            this.columnHeader4});
-            this.WeighRecord.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.WeighRecord.Location = new System.Drawing.Point(422, 214);
-            this.WeighRecord.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
-            this.WeighRecord.Name = "WeighRecord";
-            this.WeighRecord.Size = new System.Drawing.Size(404, 302);
-            this.WeighRecord.TabIndex = 174;
-            this.WeighRecord.UseCompatibleStateImageBehavior = false;
-            this.WeighRecord.View = System.Windows.Forms.View.Details;
-            // 
-            // columnHeader1
-            // 
-            this.columnHeader1.Text = "";
-            this.columnHeader1.Width = 23;
-            // 
-            // columnHeader2
-            // 
-            this.columnHeader2.Text = "箱号";
-            this.columnHeader2.Width = 127;
-            // 
-            // columnHeader3
-            // 
-            this.columnHeader3.Text = "重量";
-            this.columnHeader3.Width = 99;
-            // 
-            // columnHeader4
-            // 
-            this.columnHeader4.Text = "时间";
-            this.columnHeader4.Width = 130;
-            // 
             // pr_sendchecktype
             // 
             this.pr_sendchecktype.AutoSize = true;
@@ -655,17 +620,109 @@
             this.StepCount.StepCode = null;
             this.StepCount.TabIndex = 188;
             // 
+            // CloseServer
+            // 
+            this.CloseServer.AllPower = null;
+            this.CloseServer.BackColor = System.Drawing.Color.Transparent;
+            this.CloseServer.DownImage = ((System.Drawing.Image)(resources.GetObject("CloseServer.DownImage")));
+            this.CloseServer.Image = null;
+            this.CloseServer.IsShowBorder = true;
+            this.CloseServer.Location = new System.Drawing.Point(499, 298);
+            this.CloseServer.MoveImage = ((System.Drawing.Image)(resources.GetObject("CloseServer.MoveImage")));
+            this.CloseServer.Name = "CloseServer";
+            this.CloseServer.NormalImage = ((System.Drawing.Image)(resources.GetObject("CloseServer.NormalImage")));
+            this.CloseServer.Power = null;
+            this.CloseServer.Size = new System.Drawing.Size(60, 24);
+            this.CloseServer.TabIndex = 204;
+            this.CloseServer.Text = "关闭服务";
+            this.CloseServer.UseVisualStyleBackColor = true;
+            this.CloseServer.Click += new System.EventHandler(this.CloseServer_Click);
+            // 
+            // BuildServer
+            // 
+            this.BuildServer.AllPower = null;
+            this.BuildServer.BackColor = System.Drawing.Color.Transparent;
+            this.BuildServer.DownImage = ((System.Drawing.Image)(resources.GetObject("BuildServer.DownImage")));
+            this.BuildServer.Image = null;
+            this.BuildServer.IsShowBorder = true;
+            this.BuildServer.Location = new System.Drawing.Point(426, 298);
+            this.BuildServer.MoveImage = ((System.Drawing.Image)(resources.GetObject("BuildServer.MoveImage")));
+            this.BuildServer.Name = "BuildServer";
+            this.BuildServer.NormalImage = ((System.Drawing.Image)(resources.GetObject("BuildServer.NormalImage")));
+            this.BuildServer.Power = null;
+            this.BuildServer.Size = new System.Drawing.Size(60, 24);
+            this.BuildServer.TabIndex = 203;
+            this.BuildServer.Text = "开启服务";
+            this.BuildServer.UseVisualStyleBackColor = true;
+            this.BuildServer.Click += new System.EventHandler(this.BuildServer_Click);
+            // 
+            // Port
+            // 
+            this.Port.AllPower = null;
+            this.Port.BackColor = System.Drawing.Color.White;
+            this.Port.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Port.ID = null;
+            this.Port.Location = new System.Drawing.Point(470, 262);
+            this.Port.Name = "Port";
+            this.Port.Power = null;
+            this.Port.Size = new System.Drawing.Size(114, 23);
+            this.Port.Str = null;
+            this.Port.Str1 = null;
+            this.Port.Str2 = null;
+            this.Port.TabIndex = 202;
+            // 
+            // Port_label
+            // 
+            this.Port_label.AutoSize = true;
+            this.Port_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Port_label.Location = new System.Drawing.Point(418, 262);
+            this.Port_label.Name = "Port_label";
+            this.Port_label.Size = new System.Drawing.Size(42, 21);
+            this.Port_label.TabIndex = 201;
+            this.Port_label.Text = "端口";
+            // 
+            // IP
+            // 
+            this.IP.AllPower = null;
+            this.IP.BackColor = System.Drawing.Color.White;
+            this.IP.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.IP.ID = null;
+            this.IP.Location = new System.Drawing.Point(470, 227);
+            this.IP.Margin = new System.Windows.Forms.Padding(6, 7, 6, 7);
+            this.IP.Name = "IP";
+            this.IP.Power = null;
+            this.IP.Size = new System.Drawing.Size(114, 23);
+            this.IP.Str = null;
+            this.IP.Str1 = null;
+            this.IP.Str2 = null;
+            this.IP.TabIndex = 200;
+            // 
+            // IP_label
+            // 
+            this.IP_label.AutoSize = true;
+            this.IP_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.IP_label.Location = new System.Drawing.Point(418, 229);
+            this.IP_label.Name = "IP_label";
+            this.IP_label.Size = new System.Drawing.Size(25, 21);
+            this.IP_label.TabIndex = 199;
+            this.IP_label.Text = "IP";
+            // 
             // Make_CartonBoxSNWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1072, 560);
+            this.Controls.Add(this.CloseServer);
+            this.Controls.Add(this.BuildServer);
+            this.Controls.Add(this.Port);
+            this.Controls.Add(this.Port_label);
+            this.Controls.Add(this.IP);
+            this.Controls.Add(this.IP_label);
             this.Controls.Add(this.StepCount);
             this.Controls.Add(this.pr_sendchecktype);
             this.Controls.Add(this.RefreshWeigh);
             this.Controls.Add(this.PrintNum);
             this.Controls.Add(this.AutoPrint);
-            this.Controls.Add(this.WeighRecord);
             this.Controls.Add(this.ComList);
             this.Controls.Add(this.BaudRate);
             this.Controls.Add(this.pr_cartongw);
@@ -702,12 +759,12 @@
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.卡通箱称重_FormClosing);
             this.Load += new System.EventHandler(this.卡通箱称重_Load);
             this.SizeChanged += new System.EventHandler(this.卡通箱称重_SizeChanged);
-            this.panel6.ResumeLayout(false);
+            this.panel6.ResumeLayout(true);
             this.panel6.PerformLayout();
-            this.panel4.ResumeLayout(false);
+            this.panel4.ResumeLayout(true);
             this.panel4.PerformLayout();
             ((System.ComponentModel.ISupportInitialize)(this.fileSystemWatcher1)).EndInit();
-            this.ResumeLayout(false);
+            this.ResumeLayout(true);
             this.PerformLayout();
 
         }
@@ -746,11 +803,6 @@
         private System.Windows.Forms.Label label2;
         private CustomControl.ValueLabel.ValueLabel BaudRate;
         private CustomControl.ValueLabel.ValueLabel ComList;
-        private System.Windows.Forms.ListView WeighRecord;
-        private System.Windows.Forms.ColumnHeader columnHeader1;
-        private System.Windows.Forms.ColumnHeader columnHeader2;
-        private System.Windows.Forms.ColumnHeader columnHeader3;
-        private System.Windows.Forms.ColumnHeader columnHeader4;
         private CustomControl.CustomCheckBox.AutoPrintCheckBox AutoPrint;
         private System.Windows.Forms.Label ob_nowcheckqty;
         private System.Windows.Forms.Label ob_batchqty;
@@ -764,5 +816,11 @@
         private System.Windows.Forms.Label pr_sendchecktype;
         private System.IO.FileSystemWatcher fileSystemWatcher1;
         private CustomControl.TextBoxWithIcon.SourceStepCount StepCount;
+        private CustomControl.ButtonUtil.NormalButton CloseServer;
+        private CustomControl.ButtonUtil.NormalButton BuildServer;
+        private CustomControl.TextBoxWithIcon.EnterTextBox Port;
+        private System.Windows.Forms.Label Port_label;
+        private CustomControl.TextBoxWithIcon.SnCollectionBox IP;
+        private System.Windows.Forms.Label IP_label;
     }
 }

+ 33 - 5
UAS-MES/FunctionCode/Make/Make_CartonBoxSNWeigh.cs

@@ -34,6 +34,8 @@ namespace UAS_MES.Make
 
         Thread thread;
 
+        ModeBusTCPServer md;
+
         string PR_CHECKCARTONW = "0";
         //创建串口实例
         SerialPort serialPort1 = new SerialPort();
@@ -72,11 +74,14 @@ namespace UAS_MES.Make
             asc.controllInitializeSize(this);
             ComList.Text = BaseUtil.GetCacheData("PortName").ToString();
             BaudRate.Text = BaseUtil.GetCacheData("BaudRate").ToString();
+            IP.Text = BaseUtil.GetCacheData("IP").ToString();
+            Port.Text = BaseUtil.GetCacheData("IPPort").ToString();
             InitPrint = new Thread(InPrint);
             SetLoadingWindow stw = new SetLoadingWindow(InitPrint, "初始化打印程序");
             BaseUtil.SetFormCenter(stw);
             stw.ShowDialog();
             StartWeight.PerformClick();
+            md = new ModeBusTCPServer();
             dh = SystemInf.dh;
             StepCount.StepCode = User.CurrentStepCode;
             StepCount.Source = User.UserSourceCode;
@@ -187,11 +192,6 @@ namespace UAS_MES.Make
                             OperateResult.AppendText(">>产品" + pr_code.Text + "未维护卡通标签\n", Color.Red);
                         }
                     }
-                    ListViewItem lsi = new ListViewItem();
-                    lsi.SubItems.Add(outboxcode);
-                    lsi.SubItems.Add(ActualWeight.ToString() + pr_cartonunit.Text);
-                    lsi.SubItems.Add(System.DateTime.Now.ToString());
-                    WeighRecord.Items.Add(lsi);
                     OperateResult.AppendText(">>箱号" + outboxcode + "称重完成\n", Color.Green);
                     if (LogicHandler.CartonBoxStepPass(ma_code.Text, User.UserSourceCode, outboxcode, User.UserCode, "卡通箱:" + outboxcode + "整箱过站", out ErrorMessage))
                     {
@@ -424,5 +424,33 @@ namespace UAS_MES.Make
                     pr_cartongw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_cartonunit"].ToString();
             }
         }
+
+        private void BuildServer_Click(object sender, EventArgs e)
+        {
+            if (!md.IsOpen)
+            {
+                md.IP = IP.Text;
+                md.Port = Port.Text;
+                if (md.Open())
+                {
+                    BaseUtil.SetCacheData("IP", IP.Text);
+                    BaseUtil.SetCacheData("IPPort", Port.Text);
+                    OperateResult.AppendText(">>服务开启成功\n");
+                }
+            }
+            else
+                OperateResult.AppendText(">>服务已经开启\n");
+        }
+
+        private void CloseServer_Click(object sender, EventArgs e)
+        {
+            if (md.IsOpen)
+            {
+                md.Close();
+                OperateResult.AppendText(">>服务关闭成功\n");
+            }
+            else
+                OperateResult.AppendText(">>服务尚未开启\n");
+        }
     }
 }

+ 76 - 0
UAS-MES/FunctionCode/Make/Make_CartonBoxSNWeigh.resx

@@ -945,4 +945,80 @@
   <metadata name="fileSystemWatcher1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
   </metadata>
+  <data name="CloseServer.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="CloseServer.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="CloseServer.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="BuildServer.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="BuildServer.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="BuildServer.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
 </root>

+ 6 - 4
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -867,10 +867,12 @@ namespace UAS_MES.Make
             {
                 md.IP = IP.Text;
                 md.Port = Port.Text;
-                md.Open();
-                BaseUtil.SetCacheData("IP", IP.Text);
-                BaseUtil.SetCacheData("IPPort", Port.Text);
-                OperateResult.AppendText(">>服务开启成功\n");
+                if (md.Open())
+                {
+                    BaseUtil.SetCacheData("IP", IP.Text);
+                    BaseUtil.SetCacheData("IPPort", Port.Text);
+                    OperateResult.AppendText(">>服务开启成功\n");
+                }
             }
             else
                 OperateResult.AppendText(">>服务已经开启\n");

+ 3 - 1
UAS-MES/PublicMethod/ModeBusTCPServer.cs

@@ -75,7 +75,7 @@ namespace UAS_MES.PublicMethod
         }
 
 
-        public void Open()
+        public bool Open()
         {
             try
             {
@@ -96,10 +96,12 @@ namespace UAS_MES.PublicMethod
                 //启动线程
                 threadWatch.Start();
                 isOpen = true;
+                return true;
             }
             catch (Exception e)
             {
                 MessageBox.Show(e.Message);
+                return false;
             }
         }