lu
2025-01-03 8dbc06ffc555112cccbcbc1d32d4aa87fddf44ee
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesQaItemsDetect01.cs
@@ -1,17 +1,12 @@
using DevExpress.Utils.About;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using DevExpress.XtraRichEdit.Model;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
using MES.Service.Modes;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -30,28 +25,33 @@
            this.toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            this.toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
            this.toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
          //  this.toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            this.toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            this.toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnLogClick += ToolBarMenu1_btnLogClick;
            toolBarMenu1.btnJianYanClick += ToolBarMenu1_btnJianYanClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            gcMx1.MouseClick += GcMx1_MouseClick;
            Gs.DevApp.ToolBox.UtilityHelper.SetGridSear(gridView1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridSearMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridSearMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridSearMx(gvMx3);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx1);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx2);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameterMx(gvMx3);
            Gs.DevApp.ToolBox.UtilityHelper.SetGridViewParameter(gridView1, picCheckBox, this, "fsubmitTxt", "", (value) =>
            {
                Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 0);
            });
            Gs.DevApp.ToolBox.UtilityHelper.SetTabParameter(gridView1, xtraTabControl1, pageBar1, (value) =>
            {
                getModel(value);
            }, (value) =>
            {
                getPageList(this.pageBar1.CurrentPage);
            });
            getPageList(1);
            pageBar1.PagerEvent += PageBar1_PagerEvent;
            txt_itemId.EditChanged += (s, e) =>
            {
                txt_itemModel.Text = this.txt_itemId.GetModel();
                txt_itemNo.Text = this.txt_itemId.GetCode();
            };
            txtJianYan.KeyDown += TxtJianYan_KeyDown;
            this.btnLoad.Click += BtnLoad_Click;
            ucUpFile1.UpChanged += UcUpFile1_UpChanged;
            xtraTabControl2.SelectedPageChanged += XtraTabControl2_SelectedPageChanged;
            gvMx1.FocusedRowChanged += GvMx1_FocusedRowChanged;
        }
        private void GridView1_ColumnFilterChanged(object sender, EventArgs e)
        {
@@ -59,16 +59,17 @@
            Task.Delay(100);
            getPageList(1);
        }
        private void GcMx1_MouseClick(object sender, MouseEventArgs e)
        private void GvMx1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gvMx1, e, "guid");
            if (string.IsNullOrEmpty(rowGuid))
                return;
            var info = gvMx1.CalcHitInfo(e.Location);
            this._currentHandle5 = info.RowHandle;
            getList12(rowGuid);
            if (e.FocusedRowHandle >= 0)
            {
                DataRow row = gvMx1.GetDataRow(e.FocusedRowHandle);
                string rowGuid = row["guid"].ToString();
                if (string.IsNullOrEmpty(rowGuid))
                    return;
                getList12(rowGuid);
            }
        }
        /// <summary>
        ///  重新加载检验
        /// </summary>
@@ -94,7 +95,10 @@
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    getModel(lbGuid.Text.Trim(), false, 999);
                    getModel(lbGuid.Text.Trim());
                }
                else {
                    Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg);
                }
            }
            catch (Exception ex)
@@ -110,6 +114,7 @@
        private void TxtJianYan_KeyDown(object sender, KeyEventArgs e)
        {
            int intHandle = this.gvMx1.FocusedRowHandle;
            this._currentHandle5 = intHandle;
            if (intHandle < 0)
            {
                ToolBox.MsgHelper.Warning("提示:请选择检验项目!");
@@ -174,12 +179,16 @@
                        _webServiceName + "EdtModel12",
                        JsonConvert.SerializeObject(_obj));
                    var _rtn = UtilityHelper.ReturnToDynamic(strJson);
                    MsgHelper.Warning("提示:" + _rtn.rtnMsg);
                    if (_rtn.rtnCode > 0)
                    {
                        txtJianYan.Text = "";
                        getModel(lbGuid.Text.Trim(), false, 999);
                        this.alertControl1.Show(this, "提示!", _rtn.rtnMsg);
                        getModel(lbGuid.Text.Trim());
                    }
                    else {
                        Gs.DevApp.ToolBox.MsgHelper.ShowInformation(_rtn.rtnMsg);
                    }
                    txtJianYan.Text = "";
                }
                catch (Exception ex)
                {
@@ -188,17 +197,6 @@
            }
        }
        /// <summary>
        /// 双击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GcMain_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            string rowGuid = Gs.DevApp.ToolBox.UtilityHelper.GetCurrentDoubleRow(gridView1, e, "guid");
            if (!string.IsNullOrEmpty(rowGuid))
                getModel(rowGuid, false, 999);
        }
        /// <summary>
        /// 分页事件
        /// </summary>
@@ -280,9 +278,11 @@
                if (_rtn.rtnCode > 0)
                {
                    if (xtraTabControl1.SelectedTabPageIndex == 1)
                        getModel(lbGuid.Text.Trim(), false, 999);
                    {
                       // getModel(lbGuid.Text.Trim());
                    }
                    else
                        getPageList(1);
                        getPageList(this.pageBar1.CurrentPage);
                }
            }
            catch (Exception ex)
@@ -299,7 +299,7 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnEscClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 1);
        }
        /// <summary>
@@ -310,7 +310,7 @@
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1);
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1, "releaseNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
@@ -327,8 +327,10 @@
                ReturnModel<dynamic> _rtn = ToolBox.UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1);
                    if (xtraTabControl1.SelectedTabPageIndex == 0)
                        getPageList(this.pageBar1.CurrentPage);
                    else
                        Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 2);
                }
                ToolBox.MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
@@ -346,7 +348,7 @@
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            if (xtraTabControl1.SelectedTabPageIndex == 1)
                getModel(lbGuid.Text.Trim(), false, 999);
                getModel(lbGuid.Text.Trim());
            else
            {
                _filterList.Clear();
@@ -367,13 +369,14 @@
        private void ToolBarMenu1_btnEdtClick(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1);
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1, lbGuid, txt_releaseNo, gridView1, "releaseNo");
            if (string.IsNullOrEmpty(rowGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            getModel(rowGuid, true, 1);
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 3);
            UtilityHelper.ChangeEnableByControl(panel1.Controls, true);
        }
        /// <summary>
        /// 新增事件
@@ -382,8 +385,8 @@
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            Gs.DevApp.ToolBox.UtilityHelper.JumpTab(xtraTabControl1, 4);
            List<DevExpress.XtraGrid.Views.Grid.GridView> gridViews = new List<DevExpress.XtraGrid.Views.Grid.GridView>();
            gridViews.Add(gvMx1);
            gridViews.Add(gvMx2);
@@ -441,9 +444,9 @@
        /// <param name="pageSize">每页几条</param>
        private   void getPageList(int curPage)
        {
            var _sbSqlWhere = UtilityHelper.GetSearchWhere(_filterList);
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "create_date", "asc", "", _sbSqlWhere.ToString());
          //  _sbSqlWhere += " and isnull(fsubmit,0)=0";
            PageQueryModel pgq = new PageQueryModel(curPage, this.pageBar1.RowsCount, "release_no", "asc", "", _sbSqlWhere.ToString());
            string json = JsonConvert.SerializeObject(pgq);
            try
            {
@@ -477,15 +480,16 @@
            }
            
        }
        private   void getModel(string strGuid, bool isEdit, int tabIdx)
        private   void getModel(string strGuid)
        {
            bool isEdit = false;
            if (toolBarMenu1.currentAction == "add") return;
            if (toolBarMenu1.currentAction == "edit") isEdit = true;
            if (string.IsNullOrEmpty(strGuid))
            {
                ToolBox.MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            UtilityHelper.JumpToTab(xtraTabControl1, tabIdx);
            var _obj = new
            {
                guid = strGuid,//主建
@@ -592,7 +596,6 @@
        /// <param name="guid5"></param>
        private   void getList12(string guid5)
        {
            var _obj = new
            {
                parentGuid = UtilityHelper.ToGuid(lbGuid.Text.Trim()), //主建