Browse Source

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy 7 years ago
parent
commit
3c8af9e3f3

+ 6 - 5
UAS-出货标签管理(泽天)/CustomControl/PrinterCombox.Designer.cs

@@ -29,6 +29,7 @@
         private void InitializeComponent()
         private void InitializeComponent()
         {
         {
             this.PrinterList = new System.Windows.Forms.ComboBox();
             this.PrinterList = new System.Windows.Forms.ComboBox();
+            this.PrinterToolTip = new System.Windows.Forms.ToolTip();
             this.SuspendLayout();
             this.SuspendLayout();
             // 
             // 
             // PrinterList
             // PrinterList
@@ -37,19 +38,18 @@
             this.PrinterList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrinterList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
             this.PrinterList.FormattingEnabled = true;
             this.PrinterList.FormattingEnabled = true;
             this.PrinterList.Location = new System.Drawing.Point(0, 0);
             this.PrinterList.Location = new System.Drawing.Point(0, 0);
-            this.PrinterList.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.PrinterList.Name = "PrinterList";
             this.PrinterList.Name = "PrinterList";
-            this.PrinterList.Size = new System.Drawing.Size(284, 26);
+            this.PrinterList.Size = new System.Drawing.Size(189, 20);
             this.PrinterList.TabIndex = 0;
             this.PrinterList.TabIndex = 0;
+            this.PrinterList.SelectedIndexChanged += new System.EventHandler(this.PrinterList_SelectedIndexChanged);
             // 
             // 
             // PrinterCombox
             // PrinterCombox
             // 
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.Controls.Add(this.PrinterList);
             this.Controls.Add(this.PrinterList);
-            this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
             this.Name = "PrinterCombox";
             this.Name = "PrinterCombox";
-            this.Size = new System.Drawing.Size(284, 28);
+            this.Size = new System.Drawing.Size(189, 19);
             this.Load += new System.EventHandler(this.PrinterCombox_Load);
             this.Load += new System.EventHandler(this.PrinterCombox_Load);
             this.ResumeLayout(false);
             this.ResumeLayout(false);
 
 
@@ -58,5 +58,6 @@
         #endregion
         #endregion
 
 
         private System.Windows.Forms.ComboBox PrinterList;
         private System.Windows.Forms.ComboBox PrinterList;
+        private System.Windows.Forms.ToolTip PrinterToolTip;
     }
     }
 }
 }

+ 6 - 0
UAS-出货标签管理(泽天)/CustomControl/PrinterCombox.cs

@@ -42,5 +42,11 @@ namespace UAS_LabelMachine.CustomControl
                     PrinterList.SelectedIndex = PrinterList.Items.IndexOf(sPrint);
                     PrinterList.SelectedIndex = PrinterList.Items.IndexOf(sPrint);
             }
             }
         }
         }
+
+        private void PrinterList_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            PrinterToolTip.SetToolTip(PrinterList, PrinterList.Text);
+            PrinterToolTip.ShowAlways = true;
+        }
     }
     }
 }
 }

+ 3 - 0
UAS-出货标签管理(泽天)/CustomControl/PrinterCombox.resx

@@ -117,4 +117,7 @@
   <resheader name="writer">
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   </resheader>
+  <metadata name="PrinterToolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>
 </root>

+ 1 - 0
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs

@@ -258,6 +258,7 @@
             this.GetGridOnly.TabIndex = 82;
             this.GetGridOnly.TabIndex = 82;
             this.GetGridOnly.Text = "仅获取表格";
             this.GetGridOnly.Text = "仅获取表格";
             this.GetGridOnly.UseVisualStyleBackColor = true;
             this.GetGridOnly.UseVisualStyleBackColor = true;
+            this.GetGridOnly.Visible = false;
             // 
             // 
             // dataGridViewCheckBoxColumn1
             // dataGridViewCheckBoxColumn1
             // 
             // 

+ 65 - 57
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -387,36 +387,41 @@ namespace UAS_LabelMachine
             {
             {
                 //用标签本身的变量作为最外层的循环条件去匹配;
                 //用标签本身的变量作为最外层的循环条件去匹配;
                 StringBuilder ParamLog = new StringBuilder();
                 StringBuilder ParamLog = new StringBuilder();
+                string pibid = "";
                 for (int i = 0; i < PIBID.Length; i++)
                 for (int i = 0; i < PIBID.Length; i++)
                 {
                 {
-                    for (int j = 0; j < SingleReport.Parameters.Count; j++)
+                    if (i != PIBID.Length - 1)
+                        pibid += PIBID[i] + ",";
+                    else
+                        pibid += PIBID[i];
+                }
+                for (int j = 0; j < SingleReport.Parameters.Count; j++)
+                {
+                    SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
+                    for (int k = 0; k < Attach.Rows.Count; k++)
                     {
                     {
-                        SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
-                        for (int k = 0; k < Attach.Rows.Count; k++)
+                        if (Attach.Rows[k][0].ToString() == SingleReport.Parameters[j].Name)
                         {
                         {
-                            if (Attach.Rows[k][0].ToString() == SingleReport.Parameters[j].Name)
-                            {
-                                SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, Attach.Rows[k][1].ToString());
-                            }
+                            SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, Attach.Rows[k][1].ToString());
                         }
                         }
                     }
                     }
-                    DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiosingleinfo_view where 主键ID=" + PIBID[i], "select");
-                    SingleReport.RegisterData(dt, "prodiosingleinfo_view");
-                    SingleReport.GetDataSource("prodiosingleinfo_view").Enabled = true;
-                    SingleReport.PrintSettings.ShowDialog = false;
-                    SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
-                    try
-                    {
-                        SingleReport.Print();
-                    }
-                    catch (Exception e)
-                    {
-                        MessageBox.Show(e.Message);
-                        return;
-                    }
-                    Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
-                    Properties.Settings.Default.Save();
                 }
                 }
+                DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiosingleinfo_view where 主键ID in (" + pibid + ")", "select");
+                SingleReport.RegisterData(dt, "prodiosingleinfo_view");
+                SingleReport.GetDataSource("prodiosingleinfo_view").Enabled = true;
+                SingleReport.PrintSettings.ShowDialog = false;
+                SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
+                try
+                {
+                    SingleReport.Print();
+                }
+                catch (Exception e)
+                {
+                    MessageBox.Show(e.Message);
+                    return;
+                }
+                Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
+                Properties.Settings.Default.Save();
                 LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "自动打印箱标", "打印成功");
                 LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "自动打印箱标", "打印成功");
             }
             }
         }
         }
@@ -597,50 +602,53 @@ namespace UAS_LabelMachine
                             }
                             }
                         }
                         }
                     }
                     }
-                    //用于判断用户是否勾选了行
-                    int CheckedRowCount = 0;
+                    string pibid = "";
                     for (int i = 0; i < LabelInf.RowCount; i++)
                     for (int i = 0; i < LabelInf.RowCount; i++)
                     {
                     {
                         //勾选了并且未打印
                         //勾选了并且未打印
-                        if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString().ToLower() == "true" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString().ToLower() != "true")
+                        if (LabelInf.Rows[i].Cells["Choose"].FormattedValue != null && LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString().ToLower() == "true" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString().ToLower() != "true")
                         {
                         {
-                            for (int j = 0; j < SingleReport.Parameters.Count; j++)
-                            {
-                                SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
-                                for (int k = 0; k < Attach.Rows.Count; k++)
-                                {
-                                    if (Attach.Rows[k][0].ToString() == SingleReport.Parameters[j].Name)
-                                    {
-                                        SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, Attach.Rows[k][1].ToString());
-                                    }
-                                }
-                            }
-                            CheckedRowCount = CheckedRowCount + 1;
-                            string pib_id = LabelInf.Rows[i].Cells["pib_id1"].Value.ToString();
-                            DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiosingleinfo_view where 主键ID=" + pib_id, "select");
-                            SingleReport.RegisterData(dt, "prodiosingleinfo_view");
-                            SingleReport.GetDataSource("prodiosingleinfo_view").Enabled = true;
-                            //保存参数打印
-                            SingleReport.PrintSettings.ShowDialog = false;
-                            SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
-                            try
-                            {
-                                SingleReport.Print();
-                            }
-                            catch (Exception e)
+                            pibid += LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",";
+                            LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
+                        }
+                    }
+                    for (int j = 0; j < SingleReport.Parameters.Count; j++)
+                    {
+                        SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
+                        for (int k = 0; k < Attach.Rows.Count; k++)
+                        {
+                            if (Attach.Rows[k][0].ToString() == SingleReport.Parameters[j].Name)
                             {
                             {
-                                MessageBox.Show(e.Message);
-                                return;
+                                SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, Attach.Rows[k][1].ToString());
                             }
                             }
-                            Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
-                            Properties.Settings.Default.Save();
-                            LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
                         }
                         }
                     }
                     }
+                    if (pibid != "")
+                    {
+                        DataTable dt = (DataTable)dh.ExecuteSql("select * from prodiosingleinfo_view where 主键ID in (" + pibid.Substring(0, pibid.Length - 1) + ")", "select");
+                        SingleReport.RegisterData(dt, "prodiosingleinfo_view");
+                        SingleReport.GetDataSource("prodiosingleinfo_view").Enabled = true;
+                        //保存参数打印
+                        SingleReport.PrintSettings.ShowDialog = false;
+                        SingleReport.PrintSettings.Printer = SingleLabelPrinter.Text;
+                        try
+                        {
+                            SingleReport.Print();
+                        }
+                        catch (Exception e) 
+                        {
+                            MessageBox.Show(e.Message);
+                            return;
+                        }
+                        Properties.Settings.Default.SPrinter = SingleLabelPrinter.Text;
+                        Properties.Settings.Default.Save();
+                    }
+                    else
+                    {
+                        MessageBox.Show("未勾选打印明细!", "提示");
+                    }
                     LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "手动打印箱标", "打印成功");
                     LogManager.DoCommandLog(pi_inoutno.Text, User.UserCode, "手动打印箱标", "打印成功");
                     dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
                     dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
-                    if (CheckedRowCount == 0)
-                        MessageBox.Show("未勾选打印明细!", "提示");
                     outboxcode1.Clear();
                     outboxcode1.Clear();
                 }
                 }
                 else
                 else

BIN
UAS-出货标签管理(泽天)/tool/FastReport.Bars.dll


BIN
UAS-出货标签管理(泽天)/tool/FastReport.Editor.dll


BIN
UAS-出货标签管理(泽天)/tool/FastReport.dll


+ 3 - 21
UAS_DeviceMonitor/Main.Designer.cs

@@ -35,11 +35,6 @@ namespace UAS_DeviceMonitor
         {
         {
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Main));
             DevExpress.XtraBars.Ribbon.GalleryItemGroup galleryItemGroup1 = new DevExpress.XtraBars.Ribbon.GalleryItemGroup();
             DevExpress.XtraBars.Ribbon.GalleryItemGroup galleryItemGroup1 = new DevExpress.XtraBars.Ribbon.GalleryItemGroup();
-            DevExpress.XtraBars.Ribbon.GalleryItem galleryItem1 = new DevExpress.XtraBars.Ribbon.GalleryItem();
-            DevExpress.Utils.SuperToolTip superToolTip1 = new DevExpress.Utils.SuperToolTip();
-            DevExpress.Utils.ToolTipTitleItem toolTipTitleItem1 = new DevExpress.Utils.ToolTipTitleItem();
-            DevExpress.Utils.ToolTipItem toolTipItem1 = new DevExpress.Utils.ToolTipItem();
-            DevExpress.Utils.ToolTipTitleItem toolTipTitleItem2 = new DevExpress.Utils.ToolTipTitleItem();
             this.RibbonNav = new DevExpress.XtraBars.Ribbon.RibbonControl();
             this.RibbonNav = new DevExpress.XtraBars.Ribbon.RibbonControl();
             this.ButtonDeviceList = new DevExpress.XtraBars.BarButtonItem();
             this.ButtonDeviceList = new DevExpress.XtraBars.BarButtonItem();
             this.ButtonDeviceNetSetting = new DevExpress.XtraBars.BarButtonItem();
             this.ButtonDeviceNetSetting = new DevExpress.XtraBars.BarButtonItem();
@@ -1021,6 +1016,7 @@ namespace UAS_DeviceMonitor
             this.dpc_status.Caption = "状态";
             this.dpc_status.Caption = "状态";
             this.dpc_status.FieldName = "DPC_STATUS";
             this.dpc_status.FieldName = "DPC_STATUS";
             this.dpc_status.Name = "dpc_status";
             this.dpc_status.Name = "dpc_status";
+            this.dpc_status.OptionsColumn.AllowEdit = false;
             this.dpc_status.Visible = true;
             this.dpc_status.Visible = true;
             this.dpc_status.VisibleIndex = 6;
             this.dpc_status.VisibleIndex = 6;
             this.dpc_status.Width = 90;
             this.dpc_status.Width = 90;
@@ -1198,6 +1194,7 @@ namespace UAS_DeviceMonitor
             this.PageDeviceStatus.PageVisible = false;
             this.PageDeviceStatus.PageVisible = false;
             this.PageDeviceStatus.Size = new System.Drawing.Size(1027, 577);
             this.PageDeviceStatus.Size = new System.Drawing.Size(1027, 577);
             this.PageDeviceStatus.Text = "xtraTabPage1";
             this.PageDeviceStatus.Text = "xtraTabPage1";
+            this.PageDeviceStatus.VisibleChanged += new System.EventHandler(this.PageDeviceStatus_VisibleChanged);
             // 
             // 
             // GalleryDeviceStatus
             // GalleryDeviceStatus
             // 
             // 
@@ -1213,21 +1210,6 @@ namespace UAS_DeviceMonitor
             galleryItemGroup1.Caption = "Group9";
             galleryItemGroup1.Caption = "Group9";
             galleryItemGroup1.CaptionAlignment = DevExpress.XtraBars.Ribbon.GalleryItemGroupCaptionAlignment.Center;
             galleryItemGroup1.CaptionAlignment = DevExpress.XtraBars.Ribbon.GalleryItemGroupCaptionAlignment.Center;
             galleryItemGroup1.CaptionControlSize = new System.Drawing.Size(200, 200);
             galleryItemGroup1.CaptionControlSize = new System.Drawing.Size(200, 200);
-            galleryItem1.Caption = "Item27";
-            galleryItem1.HoverImage = global::UAS_DeviceMonitor.Properties.Resources.netstatus_tx_64px_18991_easyicon_net;
-            galleryItem1.Image = global::UAS_DeviceMonitor.Properties.Resources.devicecontrol;
-            toolTipTitleItem1.Text = "123";
-            toolTipItem1.LeftIndent = 6;
-            toolTipItem1.Text = "123";
-            toolTipTitleItem2.LeftIndent = 6;
-            toolTipTitleItem2.Text = "123";
-            superToolTip1.Items.Add(toolTipTitleItem1);
-            superToolTip1.Items.Add(toolTipItem1);
-            superToolTip1.Items.Add(toolTipTitleItem2);
-            galleryItem1.SuperTip = superToolTip1;
-            galleryItem1.Value = 0;
-            galleryItemGroup1.Items.AddRange(new DevExpress.XtraBars.Ribbon.GalleryItem[] {
-            galleryItem1});
             this.GalleryDeviceStatus.Gallery.Groups.AddRange(new DevExpress.XtraBars.Ribbon.GalleryItemGroup[] {
             this.GalleryDeviceStatus.Gallery.Groups.AddRange(new DevExpress.XtraBars.Ribbon.GalleryItemGroup[] {
             galleryItemGroup1});
             galleryItemGroup1});
             this.GalleryDeviceStatus.Gallery.ImageSize = new System.Drawing.Size(100, 100);
             this.GalleryDeviceStatus.Gallery.ImageSize = new System.Drawing.Size(100, 100);
@@ -1236,7 +1218,7 @@ namespace UAS_DeviceMonitor
             this.GalleryDeviceStatus.Name = "GalleryDeviceStatus";
             this.GalleryDeviceStatus.Name = "GalleryDeviceStatus";
             this.GalleryDeviceStatus.Size = new System.Drawing.Size(1027, 546);
             this.GalleryDeviceStatus.Size = new System.Drawing.Size(1027, 546);
             this.GalleryDeviceStatus.TabIndex = 0;
             this.GalleryDeviceStatus.TabIndex = 0;
-            this.GalleryDeviceStatus.Text = "galleryControl1";
+            this.GalleryDeviceStatus.Text = "GalleryDeviceStatus";
             // 
             // 
             // galleryControlClient1
             // galleryControlClient1
             // 
             // 

+ 34 - 2
UAS_DeviceMonitor/Main.cs

@@ -4,15 +4,16 @@ using UAS_DeviceMonitor.DataOperate;
 using System.Data;
 using System.Data;
 using System.Text;
 using System.Text;
 using UAS_DeviceMonitor.Entity;
 using UAS_DeviceMonitor.Entity;
-using UAS_DeviceMonitor.Device.Command;
 using UAS_DeviceMonitor.PublicMethod;
 using UAS_DeviceMonitor.PublicMethod;
 using DevExpress.XtraGrid.Views.Grid;
 using DevExpress.XtraGrid.Views.Grid;
 using System.Collections.Generic;
 using System.Collections.Generic;
 using System.Drawing;
 using System.Drawing;
+using DevExpress.XtraBars.Ribbon;
+using System.Threading;
 
 
 namespace UAS_DeviceMonitor
 namespace UAS_DeviceMonitor
 {
 {
-    public partial class Main : DevExpress.XtraBars.Ribbon.RibbonForm
+    public partial class Main : RibbonForm
     {
     {
 
 
         StringBuilder sql = new StringBuilder();
         StringBuilder sql = new StringBuilder();
@@ -300,6 +301,9 @@ namespace UAS_DeviceMonitor
                     Command = dt1.Rows[0]["dc_value"].ToString();
                     Command = dt1.Rows[0]["dc_value"].ToString();
                 }
                 }
                 mbt.Send(IP, Coding, Command);
                 mbt.Send(IP, Coding, Command);
+                Thread.Sleep(5000);
+                Console.WriteLine(IP);
+                Console.WriteLine(mbt.Returnvalue);
             }
             }
         }
         }
 
 
@@ -377,5 +381,33 @@ namespace UAS_DeviceMonitor
             }
             }
         }
         }
         #endregion
         #endregion
+
+        #region 设备查看界面
+        private void PageDeviceStatus_VisibleChanged(object sender, EventArgs e)
+        {
+            if (PageDeviceStatus.PageVisible)
+            {
+                //清除之前添加的图像
+                for (int i = 0; i < GalleryDeviceStatus.Gallery.Groups.Count; i++)
+                {
+                    GalleryDeviceStatus.Gallery.Groups[i].Items.Clear();
+                }
+                DataTable dt = (DataTable)dh.ExecuteSql("select * from device left join DEVICEPOLLINGCONFIG on dpc_decode=de_code ", "select");
+                for (int i = 0; i < dt.Rows.Count; i++)
+                {
+                    GalleryItem gallery;
+                    if (dt.Rows[i]["dpc_status"].ToString() == "")
+                    {
+                        gallery = new GalleryItem(Properties.Resources.devicecontrol, dt.Rows[i]["de_name"].ToString(), dt.Rows[i]["de_code"].ToString());
+                    }
+                    else
+                    {
+                        gallery = new GalleryItem(Properties.Resources.close_24px_1069872_easyicon_net, dt.Rows[i]["de_name"].ToString(), dt.Rows[i]["de_code"].ToString());
+                    }
+                    GalleryDeviceStatus.Gallery.Groups[0].Items.Add(gallery);
+                }
+            }
+        }
+        #endregion
     }
     }
 }
 }

+ 36 - 3
UAS_DeviceMonitor/PublicMethod/ModeBusTCPServer.cs

@@ -12,9 +12,13 @@ namespace UAS_DeviceMonitor.PublicMethod
     {
     {
         private bool isOpen = false;
         private bool isOpen = false;
 
 
+        private bool receiveData;
+
         Thread threadWatch = null; //负责监听客户端的线程
         Thread threadWatch = null; //负责监听客户端的线程
         Socket socketWatch = null; //负责监听客户端的套接字
         Socket socketWatch = null; //负责监听客户端的套接字
 
 
+        string returnvalue;
+
         public bool IsOpen
         public bool IsOpen
         {
         {
             get
             get
@@ -54,6 +58,32 @@ namespace UAS_DeviceMonitor.PublicMethod
             }
             }
         }
         }
 
 
+        public bool ReceiveData
+        {
+            get
+            {
+                return receiveData;
+            }
+
+            set
+            {
+                receiveData = value;
+            }
+        }
+
+        public string Returnvalue
+        {
+            get
+            {
+                return returnvalue;
+            }
+
+            set
+            {
+                returnvalue = value;
+            }
+        }
+
         private string iP;
         private string iP;
 
 
         private string port;
         private string port;
@@ -143,6 +173,7 @@ namespace UAS_DeviceMonitor.PublicMethod
                                     break;
                                     break;
                             }
                             }
                         }
                         }
+                        receiveData = false;
                     }
                     }
                     else
                     else
                     {
                     {
@@ -180,12 +211,10 @@ namespace UAS_DeviceMonitor.PublicMethod
                 //获取客户端的IP和端口号  
                 //获取客户端的IP和端口号  
                 IPAddress clientIP = (connection.RemoteEndPoint as IPEndPoint).Address;
                 IPAddress clientIP = (connection.RemoteEndPoint as IPEndPoint).Address;
                 int clientPort = (connection.RemoteEndPoint as IPEndPoint).Port;
                 int clientPort = (connection.RemoteEndPoint as IPEndPoint).Port;
-
                 //让客户显示"连接成功的"的信息  
                 //让客户显示"连接成功的"的信息  
                 string sendmsg = "Connect Success!" + "LocalIP:" + clientIP + ",LocalPort" + clientPort.ToString();
                 string sendmsg = "Connect Success!" + "LocalIP:" + clientIP + ",LocalPort" + clientPort.ToString();
                 byte[] arrSendMsg = Encoding.UTF8.GetBytes(sendmsg);
                 byte[] arrSendMsg = Encoding.UTF8.GetBytes(sendmsg);
                 connection.Send(arrSendMsg);
                 connection.Send(arrSendMsg);
-
                 //客户端网络结点号  
                 //客户端网络结点号  
                 string remoteEndPoint = connection.RemoteEndPoint.ToString();
                 string remoteEndPoint = connection.RemoteEndPoint.ToString();
                 //显示与客户端连接情况
                 //显示与客户端连接情况
@@ -225,7 +254,10 @@ namespace UAS_DeviceMonitor.PublicMethod
                         break;
                         break;
                     }
                     }
                     //将机器接受到的字节数组转换为人可以读懂的字符串     
                     //将机器接受到的字节数组转换为人可以读懂的字符串     
-                    string strSRecMsg = Encoding.UTF8.GetString(arrServerRecMsg, 0, length);
+                    lock (returnvalue)
+                    {
+                        returnvalue = Encoding.UTF8.GetString(arrServerRecMsg, 0, length);
+                    }
                     //将发送的字符串信息附加到文本框txtMsg上     
                     //将发送的字符串信息附加到文本框txtMsg上     
                 }
                 }
                 catch (Exception)
                 catch (Exception)
@@ -243,6 +275,7 @@ namespace UAS_DeviceMonitor.PublicMethod
                     break;
                     break;
                 }
                 }
             }
             }
+            receiveData = true;
             if (socketServer != null)
             if (socketServer != null)
             {
             {
                 if (socketServer.RemoteEndPoint != null)
                 if (socketServer.RemoteEndPoint != null)