Browse Source

人体测试对接

yhluo 1 week ago
parent
commit
336212a735

+ 307 - 0
UAS_MES_YTDZ/FunctionCode/Make/Make_BodyTest.Designer.cs

@@ -0,0 +1,307 @@
+namespace UAS_MES_NEW.Make
+{
+    partial class Make_BodyTest
+    {
+        /// <summary>
+        /// Required designer variable.
+        /// </summary>
+        private System.ComponentModel.IContainer components = null;
+
+        /// <summary>
+        /// Clean up any resources being used.
+        /// </summary>
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing && (components != null))
+            {
+                components.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        #region Windows Form Designer generated code
+
+        /// <summary>
+        /// Required method for Designer support - do not modify
+        /// the contents of this method with the code editor.
+        /// </summary>
+        private void InitializeComponent()
+        {
+            this.components = new System.ComponentModel.Container();
+            this.MsgBox = new System.Windows.Forms.TableLayoutPanel();
+            this.TopBox = new System.Windows.Forms.Panel();
+            this.ketVal = new System.Windows.Forms.TextBox();
+            this.ketLab = new System.Windows.Forms.Label();
+            this.claerBtn = new System.Windows.Forms.Button();
+            this.onStart = new System.Windows.Forms.Button();
+            this.IpPortUrlVal = new System.Windows.Forms.TextBox();
+            this.IpPortUrlLab = new System.Windows.Forms.Label();
+            this.timer1 = new System.Windows.Forms.Timer(this.components);
+            this.Msg1 = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
+            this.workTimeVal1 = new System.Windows.Forms.DateTimePicker();
+            this.workTimeLab1 = new System.Windows.Forms.Label();
+            this.workTimeVal2 = new System.Windows.Forms.DateTimePicker();
+            this.workTimeLab2 = new System.Windows.Forms.Label();
+            this.workTimeVal4 = new System.Windows.Forms.DateTimePicker();
+            this.workTimeLab4 = new System.Windows.Forms.Label();
+            this.workTimeVal3 = new System.Windows.Forms.DateTimePicker();
+            this.workTimeLab3 = new System.Windows.Forms.Label();
+            this.MsgBox.SuspendLayout();
+            this.TopBox.SuspendLayout();
+            this.SuspendLayout();
+            // 
+            // MsgBox
+            // 
+            this.MsgBox.ColumnCount = 2;
+            this.MsgBox.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.MsgBox.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.MsgBox.Controls.Add(this.Msg1, 1, 0);
+            this.MsgBox.Controls.Add(this.TopBox, 0, 0);
+            this.MsgBox.Dock = System.Windows.Forms.DockStyle.Top;
+            this.MsgBox.Location = new System.Drawing.Point(0, 0);
+            this.MsgBox.Name = "MsgBox";
+            this.MsgBox.RowCount = 1;
+            this.MsgBox.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+            this.MsgBox.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+            this.MsgBox.Size = new System.Drawing.Size(1280, 253);
+            this.MsgBox.TabIndex = 9;
+            // 
+            // TopBox
+            // 
+            this.TopBox.Controls.Add(this.workTimeVal4);
+            this.TopBox.Controls.Add(this.workTimeLab4);
+            this.TopBox.Controls.Add(this.workTimeVal3);
+            this.TopBox.Controls.Add(this.workTimeLab3);
+            this.TopBox.Controls.Add(this.workTimeVal2);
+            this.TopBox.Controls.Add(this.workTimeLab2);
+            this.TopBox.Controls.Add(this.workTimeVal1);
+            this.TopBox.Controls.Add(this.workTimeLab1);
+            this.TopBox.Controls.Add(this.ketVal);
+            this.TopBox.Controls.Add(this.ketLab);
+            this.TopBox.Controls.Add(this.claerBtn);
+            this.TopBox.Controls.Add(this.onStart);
+            this.TopBox.Controls.Add(this.IpPortUrlVal);
+            this.TopBox.Controls.Add(this.IpPortUrlLab);
+            this.TopBox.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.TopBox.Location = new System.Drawing.Point(3, 3);
+            this.TopBox.Name = "TopBox";
+            this.TopBox.Size = new System.Drawing.Size(634, 247);
+            this.TopBox.TabIndex = 10;
+            // 
+            // ketVal
+            // 
+            this.ketVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ketVal.Location = new System.Drawing.Point(147, 63);
+            this.ketVal.Name = "ketVal";
+            this.ketVal.Size = new System.Drawing.Size(305, 31);
+            this.ketVal.TabIndex = 12;
+            // 
+            // ketLab
+            // 
+            this.ketLab.AutoSize = true;
+            this.ketLab.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.ketLab.Location = new System.Drawing.Point(86, 63);
+            this.ketLab.Name = "ketLab";
+            this.ketLab.Size = new System.Drawing.Size(59, 28);
+            this.ketLab.TabIndex = 13;
+            this.ketLab.Text = "密钥:";
+            // 
+            // claerBtn
+            // 
+            this.claerBtn.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.claerBtn.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.claerBtn.Location = new System.Drawing.Point(285, 195);
+            this.claerBtn.Name = "claerBtn";
+            this.claerBtn.Size = new System.Drawing.Size(120, 35);
+            this.claerBtn.TabIndex = 11;
+            this.claerBtn.Text = "清除提示";
+            this.claerBtn.UseVisualStyleBackColor = true;
+            this.claerBtn.Click += new System.EventHandler(this.claerBtn_Click);
+            // 
+            // onStart
+            // 
+            this.onStart.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.onStart.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.onStart.Location = new System.Drawing.Point(429, 195);
+            this.onStart.Name = "onStart";
+            this.onStart.Size = new System.Drawing.Size(120, 35);
+            this.onStart.TabIndex = 9;
+            this.onStart.Text = "开启获取";
+            this.onStart.UseVisualStyleBackColor = true;
+            this.onStart.Click += new System.EventHandler(this.onStart_Click);
+            // 
+            // IpPortUrlVal
+            // 
+            this.IpPortUrlVal.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.IpPortUrlVal.Location = new System.Drawing.Point(147, 17);
+            this.IpPortUrlVal.Name = "IpPortUrlVal";
+            this.IpPortUrlVal.Size = new System.Drawing.Size(355, 31);
+            this.IpPortUrlVal.TabIndex = 0;
+            // 
+            // IpPortUrlLab
+            // 
+            this.IpPortUrlLab.AutoSize = true;
+            this.IpPortUrlLab.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.IpPortUrlLab.Location = new System.Drawing.Point(57, 20);
+            this.IpPortUrlLab.Name = "IpPortUrlLab";
+            this.IpPortUrlLab.Size = new System.Drawing.Size(101, 28);
+            this.IpPortUrlLab.TabIndex = 1;
+            this.IpPortUrlLab.Text = "请求地址:";
+            // 
+            // timer1
+            // 
+            this.timer1.Interval = 60000;
+            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+            // 
+            // Msg1
+            // 
+            this.Msg1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.Msg1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Msg1.Location = new System.Drawing.Point(644, 4);
+            this.Msg1.Margin = new System.Windows.Forms.Padding(4);
+            this.Msg1.Name = "Msg1";
+            this.Msg1.Size = new System.Drawing.Size(632, 245);
+            this.Msg1.TabIndex = 53;
+            this.Msg1.Text = "";
+            // 
+            // workTimeVal1
+            // 
+            this.workTimeVal1.CalendarFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal1.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.workTimeVal1.CustomFormat = "hh:mm";
+            this.workTimeVal1.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal1.Format = System.Windows.Forms.DateTimePickerFormat.Time;
+            this.workTimeVal1.Location = new System.Drawing.Point(147, 108);
+            this.workTimeVal1.Name = "workTimeVal1";
+            this.workTimeVal1.ShowUpDown = true;
+            this.workTimeVal1.Size = new System.Drawing.Size(131, 31);
+            this.workTimeVal1.TabIndex = 14;
+            this.workTimeVal1.TabStop = false;
+            this.workTimeVal1.Value = new System.DateTime(2026, 6, 16, 11, 31, 0, 0);
+            // 
+            // workTimeLab1
+            // 
+            this.workTimeLab1.AutoSize = true;
+            this.workTimeLab1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeLab1.Location = new System.Drawing.Point(57, 108);
+            this.workTimeLab1.Name = "workTimeLab1";
+            this.workTimeLab1.Size = new System.Drawing.Size(101, 28);
+            this.workTimeLab1.TabIndex = 15;
+            this.workTimeLab1.Text = "上班时间:";
+            // 
+            // workTimeVal2
+            // 
+            this.workTimeVal2.CalendarFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal2.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.workTimeVal2.CustomFormat = "hh:mm";
+            this.workTimeVal2.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal2.Format = System.Windows.Forms.DateTimePickerFormat.Time;
+            this.workTimeVal2.Location = new System.Drawing.Point(147, 153);
+            this.workTimeVal2.Name = "workTimeVal2";
+            this.workTimeVal2.ShowUpDown = true;
+            this.workTimeVal2.Size = new System.Drawing.Size(131, 31);
+            this.workTimeVal2.TabIndex = 16;
+            this.workTimeVal2.TabStop = false;
+            this.workTimeVal2.Value = new System.DateTime(2026, 6, 16, 11, 31, 0, 0);
+            // 
+            // workTimeLab2
+            // 
+            this.workTimeLab2.AutoSize = true;
+            this.workTimeLab2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeLab2.Location = new System.Drawing.Point(57, 153);
+            this.workTimeLab2.Name = "workTimeLab2";
+            this.workTimeLab2.Size = new System.Drawing.Size(101, 28);
+            this.workTimeLab2.TabIndex = 17;
+            this.workTimeLab2.Text = "上班时间:";
+            // 
+            // workTimeVal4
+            // 
+            this.workTimeVal4.CalendarFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal4.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.workTimeVal4.CustomFormat = "hh:mm";
+            this.workTimeVal4.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal4.Format = System.Windows.Forms.DateTimePickerFormat.Time;
+            this.workTimeVal4.Location = new System.Drawing.Point(388, 153);
+            this.workTimeVal4.Name = "workTimeVal4";
+            this.workTimeVal4.ShowUpDown = true;
+            this.workTimeVal4.Size = new System.Drawing.Size(131, 31);
+            this.workTimeVal4.TabIndex = 20;
+            this.workTimeVal4.TabStop = false;
+            this.workTimeVal4.Value = new System.DateTime(2026, 6, 16, 11, 31, 0, 0);
+            // 
+            // workTimeLab4
+            // 
+            this.workTimeLab4.AutoSize = true;
+            this.workTimeLab4.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeLab4.Location = new System.Drawing.Point(298, 153);
+            this.workTimeLab4.Name = "workTimeLab4";
+            this.workTimeLab4.Size = new System.Drawing.Size(101, 28);
+            this.workTimeLab4.TabIndex = 21;
+            this.workTimeLab4.Text = "下班时间:";
+            // 
+            // workTimeVal3
+            // 
+            this.workTimeVal3.CalendarFont = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal3.Cursor = System.Windows.Forms.Cursors.Hand;
+            this.workTimeVal3.CustomFormat = "hh:mm";
+            this.workTimeVal3.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeVal3.Format = System.Windows.Forms.DateTimePickerFormat.Time;
+            this.workTimeVal3.Location = new System.Drawing.Point(388, 108);
+            this.workTimeVal3.Name = "workTimeVal3";
+            this.workTimeVal3.ShowUpDown = true;
+            this.workTimeVal3.Size = new System.Drawing.Size(131, 31);
+            this.workTimeVal3.TabIndex = 18;
+            this.workTimeVal3.TabStop = false;
+            this.workTimeVal3.Value = new System.DateTime(2026, 6, 16, 11, 31, 0, 0);
+            // 
+            // workTimeLab3
+            // 
+            this.workTimeLab3.AutoSize = true;
+            this.workTimeLab3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.workTimeLab3.Location = new System.Drawing.Point(298, 108);
+            this.workTimeLab3.Name = "workTimeLab3";
+            this.workTimeLab3.Size = new System.Drawing.Size(101, 28);
+            this.workTimeLab3.TabIndex = 19;
+            this.workTimeLab3.Text = "下班时间:";
+            // 
+            // Make_BodyTest
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1280, 720);
+            this.Controls.Add(this.MsgBox);
+            this.Font = new System.Drawing.Font("微软雅黑", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Name = "Make_BodyTest";
+            this.Text = "Make_Humiture";
+            this.Load += new System.EventHandler(this.Make_Humiture_Load);
+            this.MsgBox.ResumeLayout(false);
+            this.TopBox.ResumeLayout(false);
+            this.TopBox.PerformLayout();
+            this.ResumeLayout(false);
+
+        }
+
+        #endregion
+
+        private System.Windows.Forms.TableLayoutPanel MsgBox;
+        private System.Windows.Forms.Panel TopBox;
+        private System.Windows.Forms.Timer timer1;
+        private System.Windows.Forms.Label IpPortUrlLab;
+        private System.Windows.Forms.TextBox IpPortUrlVal;
+        private System.Windows.Forms.Button onStart;
+        private System.Windows.Forms.Button claerBtn;
+        private System.Windows.Forms.TextBox ketVal;
+        private System.Windows.Forms.Label ketLab;
+        private CustomControl.RichText.RichTextAutoBottom Msg1;
+        private System.Windows.Forms.DateTimePicker workTimeVal1;
+        private System.Windows.Forms.Label workTimeLab1;
+        private System.Windows.Forms.DateTimePicker workTimeVal2;
+        private System.Windows.Forms.Label workTimeLab2;
+        private System.Windows.Forms.DateTimePicker workTimeVal4;
+        private System.Windows.Forms.Label workTimeLab4;
+        private System.Windows.Forms.DateTimePicker workTimeVal3;
+        private System.Windows.Forms.Label workTimeLab3;
+    }
+}

+ 194 - 0
UAS_MES_YTDZ/FunctionCode/Make/Make_BodyTest.cs

@@ -0,0 +1,194 @@
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Data;
+using System.Drawing;
+using System.Net.Http;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using UAS_MES_NEW.CustomControl.RichText;
+using UAS_MES_NEW.DataOperate;
+using UAS_MES_NEW.Entity;
+
+namespace UAS_MES_NEW.Make
+{
+    public partial class Make_BodyTest : Form
+    {
+        public Make_BodyTest()
+        {
+            InitializeComponent();
+        }
+
+        string url = "http://192.168.41.200:9527/";
+        string key = "c6b0ac61-bb5a-411f-9213-3ed05da979f8";
+
+        DataHelper dh;
+        DataTable dt;
+        int InsertNum = 0;
+
+        private void Make_Humiture_Load(object sender, EventArgs e)
+        {
+            IpPortUrlVal.Text = url;
+            ketVal.Text = key;
+
+            workTimeVal1.Value = DateTime.Today.AddHours(08).AddMinutes(00).AddSeconds(0);
+            workTimeVal2.Value = DateTime.Today.AddHours(12).AddMinutes(30).AddSeconds(0);
+
+            workTimeVal3.Value = DateTime.Today.AddHours(12).AddMinutes(00).AddSeconds(0);
+            workTimeVal4.Value = DateTime.Today.AddHours(17).AddMinutes(30).AddSeconds(0);
+
+            workTimeLab1.Visible = false;
+            workTimeLab2.Visible = false;
+            workTimeLab3.Visible = false;
+            workTimeLab4.Visible = false;
+
+            workTimeVal1.Visible = false;
+            workTimeVal2.Visible = false;
+            workTimeVal3.Visible = false;
+            workTimeVal4.Visible = false;
+            dh = SystemInf.dh;
+        }
+
+        private void onStart_Click(object sender, EventArgs e)
+        {
+            if (string.IsNullOrEmpty(IpPortUrlVal.Text))
+            {
+                ShowMsg(Msg1, 0, "请输出请求地址");
+                IpPortUrlVal.Focus();
+                IpPortUrlVal.SelectAll();
+                return;
+            }
+
+            if (onStart.Text == "获取中")
+            {
+                IpPortUrlVal.Enabled = true;
+                ketVal.Enabled = true;
+                workTimeVal1.Enabled = true;
+                workTimeVal2.Enabled = true;
+                workTimeVal3.Enabled = true;
+                workTimeVal4.Enabled = true;
+                onStart.Text = "开启获取";
+                timer1.Stop();
+            }
+            else
+            {
+                IpPortUrlVal.Enabled = false;
+                ketVal.Enabled = false;
+                workTimeVal1.Enabled = false;
+                workTimeVal2.Enabled = false;
+                workTimeVal3.Enabled = false;
+                workTimeVal4.Enabled = false;
+                onStart.Text = "获取中";
+                ShowMsg(Msg1, 2, $"执行间隔:{timer1.Interval / 60000}分钟");
+                timer1.Start();
+                //timer1_Tick(null, null);
+            }
+        }
+        private async void timer1_Tick(object sender, EventArgs e)
+        {
+            try
+            {
+                string apiUrl = IpPortUrlVal.Text.Trim() + "api/AcsDataApi/GetData";
+                DateTime startTime = DateTime.Now.Date;
+                DateTime endTime = DateTime.Now.Date.AddDays(1).AddSeconds(-1);
+
+                var dataObject = new
+                {
+                    Key = ketVal.Text.Trim(),
+                    Type = "Event",
+                    STime = startTime.ToString("yyyy-MM-dd HH:mm:ss"),
+                    ETime = endTime.ToString("yyyy-MM-dd HH:mm:ss"),
+                    IsAllType = "0"
+                };
+                string result = await HttpHelper.PostAsync(apiUrl, dataObject);
+                JObject root = JObject.Parse(result);
+                JArray dataArr = (JArray)root["Data"];
+
+
+                if (root["Code"].ToString() == "1")
+                {
+                    ShowMsg(Msg1, 1, $"获取人体测试仪设备成功,已获取到{dataArr.Count}条记录");
+                }
+                InsertNum = 0;
+                foreach (JToken item in dataArr)
+                {
+                    string DeptName = item["DeptName"].ToString();
+                    string EmployeeCode = item["EmployeeCode"].ToString();
+                    string EmployeeName = item["EmployeeName"].ToString();
+                    string EventName = item["EventName"].ToString();
+                    string ControlName = item["ControlName"].ToString();
+
+                    string EventID = item["EventID"].ToString();
+                    string EventTime = item["EventTime"].ToString();
+                    DateTime.TryParse(EventTime, out DateTime dtHour);
+                    string timeType = dtHour.Hour < 11 ? "上午" : "下午";
+
+
+                    dt = (DataTable)dh.ExecuteSql($"select * from bodytest where BT_EVENTID = '{EventID}'", "select");
+                    if (dt.Rows.Count == 0)
+                    {
+                        string sql = $@"INSERT INTO BODYTEST (BT_ID,BT_DEPTNAME,BT_EMPNO,BT_EMP,BT_TYPE,BT_TIMETYPE,
+                            BT_HAND,BT_DHAND,BT_LEFTSHOES,BT_RIGHTSHOES,BT_CONTROLNAME,BT_EVENTID,BT_INDATE) VALUES 
+                            (BODYTEST_SEQ.NEXTVAL,'{DeptName}','{EmployeeCode}','{EmployeeName}','{EventName}','{timeType}',
+                            '','','','','{ControlName}','{EventID}',to_date('{EventTime}', 'YYYY-MM-DD HH24:MI:SS'))";
+
+                        dh.ExecuteSql(sql, "insert");
+                        InsertNum += 1;
+                    }
+                }
+
+                ShowMsg(Msg1, 1, $"人体测试信息已记录{InsertNum}条记录");
+            }
+            catch (Exception ex)
+            {
+                ShowMsg(Msg1, 0, $"获取数据时发生错误: {ex.Message}");
+            }
+        }
+
+
+        private void claerBtn_Click(object sender, EventArgs e)
+        {
+            Msg1.Clear();
+        }
+
+        private void ShowMsg(RichTextAutoBottom msgBox, int type, string msg)
+        {
+            msg = msg.Replace("\r", "").Replace("\n", "");
+            string msgTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+            string showMsg = $"{msgTime}: {msg}\n";
+
+            if (type == 0)
+            {
+                msgBox.AppendText(showMsg, Color.Red);
+                msgBox.SelectionStart = msgBox.Text.Length;
+                msgBox.ScrollToCaret();
+            }
+            else if (type == 1)
+            {
+                msgBox.AppendText(showMsg, Color.Green);
+                msgBox.SelectionStart = msgBox.Text.Length;
+                msgBox.ScrollToCaret();
+            }
+            else if (type == 2)
+            {
+                msgBox.AppendText(showMsg, Color.YellowGreen);
+                msgBox.SelectionStart = msgBox.Text.Length;
+                msgBox.ScrollToCaret();
+            }
+        }
+        public static class HttpHelper
+        {
+            public static async Task<string> PostAsync<T>(string url, T data)
+            {
+                var client = new HttpClient();
+                string json = JsonConvert.SerializeObject(data);
+                var content = new StringContent(json, Encoding.UTF8, "application/json");
+                var response = await client.PostAsync(url, content);
+                response.EnsureSuccessStatusCode();
+                return await response.Content.ReadAsStringAsync();
+            }
+        }
+
+    }
+}

+ 123 - 0
UAS_MES_YTDZ/FunctionCode/Make/Make_BodyTest.resx

@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" use="required" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+              <xsd:attribute ref="xml:space" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
+</root>

+ 9 - 0
UAS_MES_YTDZ/UAS_MES_YTDZ.csproj

@@ -561,6 +561,12 @@
     <Compile Include="FunctionCode\Make\Make_FeedingCollectionCombine.Designer.cs">
       <DependentUpon>Make_FeedingCollectionCombine.cs</DependentUpon>
     </Compile>
+    <Compile Include="FunctionCode\Make\Make_BodyTest.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FunctionCode\Make\Make_BodyTest.Designer.cs">
+      <DependentUpon>Make_BodyTest.cs</DependentUpon>
+    </Compile>
     <Compile Include="FunctionCode\Make\Make_Humiture.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -1342,6 +1348,9 @@
     <EmbeddedResource Include="FunctionCode\Make\Make_FeedingCollectionCombine.resx">
       <DependentUpon>Make_FeedingCollectionCombine.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Make\Make_BodyTest.resx">
+      <DependentUpon>Make_BodyTest.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Make\Make_Humiture.resx">
       <DependentUpon>Make_Humiture.cs</DependentUpon>
     </EmbeddedResource>