From 878aad490fc15b11d63fb4fa7ab7ada260f66310 Mon Sep 17 00:00:00 2001
From: lu <123456>
Date: 星期六, 09 八月 2025 10:03:59 +0800
Subject: [PATCH] iqc称重

---
 DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs |  149 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 148 insertions(+), 1 deletions(-)

diff --git a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
index 32dbf78..667d8df 100644
--- a/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
+++ b/DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
@@ -1,3 +1,5 @@
+using DevExpress.Pdf.Native.BouncyCastle.Utilities.Collections;
+using DevExpress.XtraRichEdit.API.Native;
 using Gs.DevApp.DevFrm.QC;
 using Gs.DevApp.Entity;
 using Gs.DevApp.ToolBox;
@@ -10,6 +12,7 @@
 using System.Data;
 using System.Net;
 using System.Threading.Tasks;
+using System.Timers;
 using System.Windows.Forms;
 
 namespace Gs.DevApp.DevFrm
@@ -19,6 +22,10 @@
         string _strTag = "N:涓嶅悎鏍�";
         string _webServiceName = "MesQaItemsDetect01Manager/";
         List<FilterEntity> _filterList = new List<FilterEntity>();
+        /// <summary>
+        /// 瀹氭椂鍒锋柊
+        /// </summary>
+        System.Timers.Timer timer = new System.Timers.Timer(1000);
         public Frm_MesQaItemsDetect01()
         {
             InitializeComponent();
@@ -54,8 +61,147 @@
             gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
             btnIpt.Click += BtnIpt_Click;
             btnYcReport.Click += BtnYcReport_Click;
-        }
+            //鍏抽棴鏃堕噴鏀総imer
+            this.Disposed += (s, e) =>
+            {
+                // MessageBox.Show("ddddddd");
+                if (timer != null)
+                {
+                    timer.Stop();
+                    timer.Dispose();
+                }
+            };
+            timer.Elapsed += (s, e) =>
+            {
+                var _obj = new
+                {
 
+                };
+                try
+                {
+                    var strReturn = UtilityHelper.HttpPost("", "WorkWeight/GetIqcWeight", JsonConvert.SerializeObject(_obj), false);
+                    var dd = UtilityHelper.ReturnToDynamic(strReturn);
+                    if (dd.rtnCode > 0)
+                    {
+                        BeginInvoke(new Action(() =>
+                        {
+                            txtWCurrent.Text = dd.rtnData;
+                        }));
+                    }
+                }
+                catch (Exception ex)
+                {
+
+                }
+            };
+            timer.AutoReset = true; // 璁剧疆涓簍rue琛ㄧず閲嶅鎵ц锛宖alse琛ㄧず鎵ц涓�娆″悗鍋滄
+            timer.Enabled = true; // 寮�濮嬭鏃�
+            //璇诲彇閲嶉噺
+            this.btnW.Click += (s, e) =>
+            {
+                string _strCurrent = this.txtWCurrent.Text.Trim();
+                bool _isNumeric = decimal.TryParse(_strCurrent, out _);
+                if (!_isNumeric)
+                {
+                    ToolBox.MsgHelper.ShowError("璇锋鏌ョО閲嶈缃紒");
+                    return;
+                }
+                decimal _decCurrent = decimal.Parse(_strCurrent);
+                if (_decCurrent * 1 <= 0)
+                {
+                    ToolBox.MsgHelper.ShowError("璇锋鏌ョО閲嶈缃紒");
+                    return;
+                }
+                if (txtW1.Text.Trim().Length <= 0)
+                {
+                    _setWeigth(1, _strCurrent);
+                    return;
+                }
+                if (txtW2.Text.Trim().Length <= 0)
+                {
+                    _setWeigth(2, _strCurrent);
+                    return;
+                }
+                if (txtW3.Text.Trim().Length <= 0)
+                {
+                    _setWeigth(3, _strCurrent);
+                    return;
+                }
+                if (txtW4.Text.Trim().Length <= 0)
+                {
+                    _setWeigth(4, _strCurrent);
+                    return;
+                }
+                if (txtW5.Text.Trim().Length <= 0)
+                {
+                    _setWeigth(5, _strCurrent);
+                    return;
+                }
+                ToolBox.MsgHelper.ShowError("閲嶉噺宸茶幏鍙栧畬姣曪紒");
+                return;
+            };
+            //娓呯┖
+            this.btnClean.Click += (s, e) =>
+            {
+                _setWeigth(1, "");
+                this.txtW1.Text = this.txtW2.Text = this.txtW3.Text = this.txtW4.Text = this.txtW5.Text = "";
+            };
+        }
+        /// <summary>
+        /// 鎻愪氦绉伴噸
+        /// </summary>
+        /// <param name="_weightType"></param>
+        /// <param name="_weight"></param>
+        private void _setWeigth(int _weightType, string _weight)
+        {
+            var _obj = new
+            {
+                iqcGuid = this.txt_guid.Text.Trim(),
+                weightType = _weightType,
+                weight = _weight
+            };
+            try
+            {
+                var strReturn = UtilityHelper.HttpPost("", "WorkWeight/EditIqc", JsonConvert.SerializeObject(_obj), false);
+                var dd = UtilityHelper.ReturnToDynamic(strReturn);
+                if (dd.rtnCode <= 0)
+                {
+                    ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + dd.rtnMsg);
+                }
+                else
+                {
+                    if (_weightType == 1)
+                    {
+                        txtW1.Text = _weight;
+                        return;
+                    }
+                    if (_weightType == 2)
+                    {
+                        txtW2.Text = _weight;
+                        return;
+                    }
+                    if (_weightType == 3)
+                    {
+                        txtW3.Text = _weight;
+                        return;
+                    }
+                    if (_weightType == 4)
+                    {
+                        txtW4.Text = _weight;
+                        return;
+                    }
+                    if (_weightType == 5)
+                    {
+                        txtW5.Text = _weight;
+                        return;
+                    }
+                }
+            }
+            catch (Exception ex)
+            {
+                ToolBox.MsgHelper.ShowError("鎻愮ず锛�" + ex.Message);
+            }
+        }
 
         /// <summary>
         /// 鎵归噺褰曞叆
@@ -591,6 +737,7 @@
             txtJianYan.ReadOnly = !bl;
             btnLoad.Enabled = bl;
             btnIpt.Text = (bl == true ? "褰曞叆鏍锋湰" : "鏌ョ湅鏍锋湰");
+            btnW.Enabled = btnClean.Enabled = bl;
         }
 
         #region 鎵撳紑鐖朵翰绐楀彛濮旀墭锛屾煡鐪嬪紓甯告姤鍛�

--
Gitblit v1.9.3