1
lu
2024-11-16 3ff3c816c74c077a320c4a9cb3094fb0b9fcc2c5
DevApp/Gs.DevApp/DevFrm/QC/Frm_MesSysLookups.cs
@@ -6,31 +6,30 @@
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraGrid.Views.Base.ViewInfo;
using DevExpress.XtraGrid.Views.Grid;
using Gs.DevApp.DevFrm.QC.Models;
using Gs.DevApp.Entity;
using Gs.DevApp.ToolBox;
using Gs.DevApp.UserControl;
using MES.Service.Modes;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Gs.DevApp.DevFrm
namespace Gs.DevApp.DevFrm.QC
{
    public partial class Frm_MesSysLookups : XtraForm
    {
        private List<FilterEntity> _filterList = new List<FilterEntity>();
        private readonly string _webServiceName = "MesSysLookupTypesManager/";
        private List<FilterEntity> _filterList = new List<FilterEntity>();
        public Frm_MesSysLookups()
        {
            InitializeComponent();
            toolBarMenu1.btnAddClick += ToolBarMenu1_btnAddClick;
            toolBarMenu1.btnEdtClick += ToolBarMenu1_btnEdtClick;
            toolBarMenu1.btnSaveClick += ToolBarMenu1_btnSaveClick;
            toolBarMenu1.btnLoadClick += ToolBarMenu1_btnLoadClick;
            toolBarMenu1.btnDelClick += ToolBarMenu1_btnDelClick1;
            toolBarMenu1.btnEscClick += ToolBarMenu1_btnEscClick;
            toolBarMenu1.btnQueryClick += ToolBarMenu1_btnQueryClick;
            toolBarMenu1.btnChkClick += ToolBarMenu1_btnChkClick;
            toolBarMenu1.btnFChkClick += ToolBarMenu1_btnFChkClick;
            gcMain.MouseDoubleClick += GcMain_MouseDoubleClick;
            getPageList(1, UtilityHelper.GetPageSize());
            pageBar1.PagerEvent += PageBar1_PagerEvent;
@@ -73,32 +72,34 @@
        {
            getPageList(curPage, pageSize);
        }
        /// <summary>
        ///     查询事件
        ///     反审核
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnQueryClick(object sender, EventArgs e)
        /// <exception cref="NotImplementedException"></exception>
        private void ToolBarMenu1_btnFChkClick(object sender, EventArgs e)
        {
            var frm =
                new ShowFilter(gridView1.Columns,
                    _filterList);
            frm.UpdateParent += Frm_UpdateParent;
            frm.ShowDialog();
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_lookupTypeCode, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///     查询回调
        ///     审核事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Frm_UpdateParent(object sender, UpdateParentEventArgs e)
        private void ToolBarMenu1_btnChkClick(object sender, EventArgs e)
        {
            _filterList = e.FilterList;
            getPageList(1, pageBar1.RowsCount);
            toolBarMenu1.guidKey = "";
            string rowGuid, rowName;
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_lookupTypeCode, gridView1);
            toolBarMenu1.guidKey = rowGuid;
        }
        /// <summary>
        ///     取消事件
        /// </summary>
@@ -110,56 +111,16 @@
        }
        /// <summary>
        ///     删除事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnDelClick1(object sender, EventArgs e)
        {
            string rowGuid = "", rowName = "";
            (rowGuid, rowName) = UtilityHelper.GetCurrentRow(xtraTabControl1,
                lbGuid, txt_lookupTypeCode, gridView1);
            if (string.IsNullOrEmpty(rowGuid))
            {
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            if (!MsgHelper.AskQuestion("你选择了【" + rowName + "】,确定删除吗?"))
                return;
            var lst = new List<dynamic>();
            lst.Add(rowGuid);
            var _obj = lst;
            try
            {
                var strJson = UtilityHelper.HttpPost("",
                    _webServiceName + "DeleteModel",
                    JsonConvert.SerializeObject(_obj));
                var _rtn =
                    UtilityHelper.ReturnToDynamic(strJson);
                if (_rtn.rtnCode > 0)
                {
                    UtilityHelper.JumpToTab(xtraTabControl1, 0);
                    getPageList(1, UtilityHelper.GetPageSize());
                }
                MsgHelper.Warning("提示:" + _rtn.rtnMsg);
            }
            catch (Exception ex)
            {
                MsgHelper.Warning("提示:" + ex.Message);
            }
        }
        /// <summary>
        ///     刷新事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnLoadClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 0);
            getPageList(1, UtilityHelper.GetPageSize());
            if (xtraTabControl1.SelectedTabPageIndex == 1)
                getModel(lbGuid.Text.Trim(), false, 999);
            else
                getPageList(1, UtilityHelper.GetPageSize());
        }
        /// <summary>
@@ -177,25 +138,7 @@
                MsgHelper.Warning("请先选择你要操作的行!");
                return;
            }
            getModel(rowGuid, true, 1);
        }
        /// <summary>
        ///     新增事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ToolBarMenu1_btnAddClick(object sender, EventArgs e)
        {
            UtilityHelper.JumpToTab(xtraTabControl1, 1);
            lbGuid.Text = "";
            var gridViews =
                new List<GridView>();
            gridViews.Add(gvMx1);
            UtilityHelper.CleanValueByControl(panel1.Controls, true,
                gridViews);
            UtilityHelper.SetDefaultTable(gcMx1, gvMx1);
        }
        /// <summary>
@@ -212,7 +155,8 @@
                txt_lookupTypeCode.Focus();
                return;
            }
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            var lst = new List<MesSysLookups>();
            for (var i = 0; i < gvMx1.DataRowCount; i++)
            {
@@ -220,9 +164,7 @@
                if (row != null)
                    lst.Add(new MesSysLookups
                    {
                        Guid = row["Guid"].ToString().Length > 0
                            ? Guid.Parse(row["Guid"].ToString())
                            : Guid.Empty,
                        Guid = UtilityHelper.ToGuid(row["Guid"].ToString()),
                        LookupName = row["LookupName"].ToString(),
                        LookupValue = row["LookupValue"].ToString()
                    });
@@ -230,14 +172,11 @@
            var _obj = new MesSysLookupTypes
            {
                Guid = lbGuid.Text.Trim().Length > 0
                    ? Guid.Parse(lbGuid.Text.Trim())
                    : Guid.Empty,
                Guid = UtilityHelper.ToGuid(lbGuid.Text.Trim()),
                LookupTypeCode = txt_lookupTypeCode.Text,
                LookupTypeName = txt_lookupTypeName.Text,
                list = lst
            };
            try
            {
                var strJson = UtilityHelper.HttpPost("",
@@ -250,8 +189,10 @@
                {
                    lbGuid.Text = _rtn.rtnData;
                    toolBarMenu1.isSetBtn = true;
                    UtilityHelper.ChangeEnableByControl(panel1.Controls,
                        false);
                    var gridViews = new List<GridView>();
                    gridViews.Add(gvMx1);
                    UtilityHelper.ChangeEnableByControl(panel1.Controls, false,
                        gridViews);
                }
            }
            catch (Exception ex)
@@ -272,6 +213,7 @@
                _sbSqlWhere.Append(" and " + itm.fileId + itm.fileOper + "'" +
                                   itm.fileValue + "'");
            _sbSqlWhere.Append("and LOOKUP_TYPE_CODE = 'QATOOLS'");
            var pgq = new PageQueryModel(curPage, pageSize,
                "create_date", "asc", "", _sbSqlWhere.ToString());
            var json = JsonConvert.SerializeObject(pgq);
@@ -360,6 +302,8 @@
        private void repositoryItemButtonEdit1_ButtonClick(object sender,
            ButtonPressedEventArgs e)
        {
            gvMx1.CloseEditor();
            gvMx1.UpdateCurrentRow();
            var rowhandle = gvMx1.FocusedRowHandle;
            if (rowhandle < 0)
                return;
@@ -369,6 +313,11 @@
                var mxGuid = dr["guid"].ToString();
                if (!MsgHelper.AskQuestion("你选择了1条数据,确定删除吗?"))
                    return;
                if (string.IsNullOrEmpty(mxGuid))
                {
                    gvMx1.DeleteRow(rowhandle);
                    return;
                }
                var strJson = "";
                var lst = new List<string>();
                lst.Add(mxGuid);