新框架PC前端标准版(祈禧6月初版本)
lg
2025-11-25 0ac254ca6f2a75d591b1f602d34e7b46b8d01837
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
@@ -20,23 +20,10 @@
        string _strTag = "N:不合格";
        string _webServiceName = "MesQaItemsDetect01Manager/";
        List<FilterEntity> _filterList = new List<FilterEntity>();
        /// <summary>
        /// 定时刷新
        /// </summary>
        System.Timers.Timer timer;
        public Frm_MesQaItemsDetect01()
        {
            InitializeComponent();
            #region 设置时间
            int int32 = 3000;
            string _vanishingSeconds = ConfigurationManager.AppSettings["IqcGetWeight"];
            if (!string.IsNullOrEmpty(_vanishingSeconds))
                int32 = int.Parse(_vanishingSeconds);
            timer = new System.Timers.Timer(int32);
            #endregion
            this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
@@ -68,159 +55,8 @@
            xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged;
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
            btnIpt.Click += BtnIpt_Click;
            btnYcReport.Click += BtnYcReport_Click;
            #region 五次重量
            //关闭时释放timer
            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)
                {
                    Gs.DevApp.ToolBox.LogHelper.Debug(this.ToString(), "WorkWeight/GetIqcWeight:" + ex.Message);
                }
            };
            timer.AutoReset = true; // 设置为true表示重复执行,false表示执行一次后停止
            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 (txt_weight1.Text.Trim().Length <= 0)
                {
                    _setWeigth(1, _strCurrent);
                    return;
                }
                if (txt_weight2.Text.Trim().Length <= 0)
                {
                    _setWeigth(2, _strCurrent);
                    return;
                }
                if (txt_weight3.Text.Trim().Length <= 0)
                {
                    _setWeigth(3, _strCurrent);
                    return;
                }
                if (txt_weight4.Text.Trim().Length <= 0)
                {
                    _setWeigth(4, _strCurrent);
                    return;
                }
                if (txt_weight5.Text.Trim().Length <= 0)
                {
                    _setWeigth(5, _strCurrent);
                    return;
                }
                ToolBox.MsgHelper.ShowError("重量已获取完毕!");
                return;
            };
            //清空
            this.btnClean.Click += (s, e) =>
            {
                if (!MsgHelper.AskQuestion("你选择了【" + txt_releaseNo.Text.Trim() + "】,确定清除所有称重数据吗?"))
                    return;
                _setWeigth(99, "");
            };
            #endregion
        }
        /// <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/EditIqcWeight", JsonConvert.SerializeObject(_obj), false);
                var dd = UtilityHelper.ReturnToDynamic(strReturn);
                if (dd.rtnCode <= 0)
                {
                    ToolBox.MsgHelper.ShowError("提示:" + dd.rtnMsg);
                }
                else
                {
                    if (_weightType == 1)
                    {
                        txt_weight1.Text = _weight;
                        return;
                    }
                    if (_weightType == 2)
                    {
                        txt_weight2.Text = _weight;
                        return;
                    }
                    if (_weightType == 3)
                    {
                        txt_weight3.Text = _weight;
                        return;
                    }
                    if (_weightType == 4)
                    {
                        txt_weight4.Text = _weight;
                        return;
                    }
                    if (_weightType == 5)
                    {
                        txt_weight5.Text = _weight;
                        return;
                    }
                    if (_weightType == 99)
                    {
                        this.txt_weight1.Text = this.txt_weight2.Text = this.txt_weight3.Text = this.txt_weight4.Text = this.txt_weight5.Text = "";
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                ToolBox.MsgHelper.ShowError("提示:" + ex.Message);
            }
        }
        /// <summary>
        /// 批量录入
        /// </summary>
@@ -403,8 +239,6 @@
                lbGuid, txt_releaseNo, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
        {
            _toolCk("EditModelSubmit");
@@ -766,31 +600,7 @@
            txtJianYan.ReadOnly = !bl;
            btnLoad.Enabled = bl;
            btnIpt.Text = (bl == true ? "录入样本" : "查看样本");
            btnW.Enabled = btnClean.Enabled = bl;
        }
        #region 打开父亲窗口委托,查看异常报告
        public event EventHandler<UpdateParentEventArgs> ToUpdateParent;
        private void BtnYcReport_Click(object sender, EventArgs e)
        {
            string _toGuid = (btnYcReport.ToolTip == null ? "" : btnYcReport.ToolTip.ToString());
            if (string.IsNullOrEmpty(_toGuid))
            {
                Gs.DevApp.ToolBox.MsgHelper.ShowInformation("该单无异常报告,查看失败!");
                return;
            }
            if (ToUpdateParent != null)
            {
                List<string> lst = new List<string>();
                lst.Add("Gs.DevApp.DevFrm.QC.MesQcExceptional");//类名
                lst.Add(_toGuid);//异常报告主键
                lst.Add("tab1");//其它
                ToUpdateParent?.Invoke(this,
                new UpdateParentEventArgs { StringList = lst });
            }
        }
        #endregion
        /// <summary>
        /// 检验和反检验